mysterymath wrote:

> Hi, digging into this a bit more, it looks like handling of builtins is 
> different in C and C++ mode: in C mode attributes are initialized earlier and 
> are available for the validation, while in C++ this is skipped, so that the 
> format attribute is only added after the validation.
> 
> I removed the hardcoded attributes from this patch and added my local fix as 
> a demonstration - it extends the validation logic to expect that builtins and 
> the special asprintf-like functions will get the attribute eventually.
> 
> Other ways to fix would be to move validation or addition of implicit 
> attributes around, which is a bigger structural change.
> 
> Please let me know what you think, thanks!

Ah, thanks for looking into this; sorry that I've been a bit busy. I do think 
this patch will broadly work now, but I want to compare against one of the more 
intrinsic ways of solving it; duplicating the printf-like detection logic is 
not the greatest. But, we can fall back to this if need be and clean it up 
later I think.

https://github.com/llvm/llvm-project/pull/194003
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to