[clang] [clang] Catch missing format attributes (PR #105479)
Budimir Aranđelović via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 30 00:47:59 PDT 2024
budimirarandjelovichtec wrote:
> Can you explain what changes were made to address the various issues which caused the earlier revert? I've tried diffing the PRs to see what the changes are, but my git-fu is insufficient to the task. :-D
I made changes in several places. Here are major changes:
1) determining first argument index. Here I removed dynamic cast to DeclRefAttr of last function argument. In C++ mode casting to DeclRefAttr resulted in unrecognizing argument type as va_list for several architectures and OS. So, some architectures gave 0 as output and others gave non-zero value. Unrecognizing argument type as va_list was a result of defining canonical va_list type differently depending on architecture.
2) added check if calling function has format attribute before iterating through its format attributes. This check was added because one pointer (AttrType) was initialized in iteration through format attributes and later used to get name if missing attribute was caught. In previous merge this was resulting in throwing error that there were use of uninitialized variable for some architectures.
3) edited some parts of C code where passed arguments were not valid. Examples are passing &args[0] or char * as va_list argument (functions f8() and f41()).
Relevant parts of code are reviewed in [#106649 ](https://github.com/llvm/llvm-project/pull/106649/).
https://github.com/llvm/llvm-project/pull/105479
More information about the cfe-commits
mailing list