[PATCH] D112569: -Wformat-nonliteral should not trigger for format strings passed to blocks with __attribute__((format))

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 26 19:29:31 PDT 2021


ahatanak added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:7788
+            if (MD && MD->isInstance())
+              ++PVIndex;
+            for (const auto *PVFormat : D->specific_attrs<FormatAttr>()) {
----------------
Isn't changing `dyn_cast<NamedDecl` to `dyn_cast<Decl>` enough to avoid the warning? Just wondering why it is also necessary to move the above code out of the for loop. Actually, it's not clear to me why `PVIndex` had to be incremented in the loop in the first place.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112569/new/

https://reviews.llvm.org/D112569



More information about the cfe-commits mailing list