[clang] [attributes][analyzer] Generalize [[clang::suppress]] to declarations. (PR #80371)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 06:57:59 PST 2024


================
@@ -147,6 +147,20 @@ bool BugSuppression::isSuppressed(const PathDiagnosticLocation &Location,
     // done as well as perform a lot of work we'll never need.
     // Gladly, none of our on-by-default checkers currently need it.
     DeclWithIssue = ACtx.getTranslationUnitDecl();
+  } else {
+    // This is the fast path. However, we should still consider the topmost
+    // declaration that isn't TranslationUnitDecl, because we should respect
+    // attributes on the entire declaration chain.
+    while (true) {
----------------
erichkeane wrote:

What is going on here?  How does this differ from just `getTranslationUnitDecl`? 

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


More information about the cfe-commits mailing list