]> granicus.if.org Git - clang/commitdiff
Don't bother running the analysis for CFG-based warnings if the
authorTed Kremenek <kremenek@apple.com>
Sat, 20 Mar 2010 21:11:09 +0000 (21:11 +0000)
committerTed Kremenek <kremenek@apple.com>
Sat, 20 Mar 2010 21:11:09 +0000 (21:11 +0000)
declaration is in a system header.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99087 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/AnalysisBasedWarnings.cpp

index 9eb5b7f5a58ff3c425c60fe16d32bd90df42e662..c4ceec0f8111edaaa4fcbefefc4a13c7b1c25a29 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "Sema.h"
 #include "AnalysisBasedWarnings.h"
+#include "clang/Basic/SourceManager.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/StmtObjC.h"
@@ -325,6 +326,12 @@ void clang::sema::AnalysisBasedWarnings::IssueWarnings(const Decl *D,
   
   assert(BlockTy.isNull() || isa<BlockDecl>(D));
   
+  // Do not do any analysis for declarations in system headers if we are
+  // going to just ignore them.
+  if (S.getDiagnostics().getSuppressSystemWarnings() &&
+      S.SourceMgr.isInSystemHeader(D->getLocation()))
+    return;
+
   // We avoid doing analysis-based warnings when there are errors for
   // two reasons:
   // (1) The CFGs often can't be constructed (if the body is invalid), so