[clang] Update Catch missing format attributes (PR #106649)

Budimir Aranđelović via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 30 00:54:04 PDT 2024


================
@@ -5416,15 +5416,18 @@ Sema::GetMissingFormatAttributes(Stmt *Body, const FunctionDecl *FDecl) {
     // If child expression is function, check if it is format function.
     // If it is, check if parent function misses format attributes.
 
+    unsigned int ChildFunctionFormatArgumentIndexOffset =
+        checkIfMethodHasImplicitObjectParameter(ChildFunction) ? 2 : 1;
+
+    if (!ChildFunction->hasAttr<FormatAttr>())
----------------
budimirarandjelovichtec wrote:

This check was added because there is llvm::any_of later and one pointer can only be assigned inside llvm::any_of. This pointer is later called if format attribute was caught. This change prevents throwing error that unitialized value was used.

https://github.com/llvm/llvm-project/pull/106649


More information about the cfe-commits mailing list