From d068aabc484c4009282122c6ef26e66e68cfa044 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Sat, 20 Mar 2010 21:11:09 +0000 Subject: [PATCH] Don't bother running the analysis for CFG-based warnings if the 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index 9eb5b7f5a5..c4ceec0f81 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/lib/Sema/AnalysisBasedWarnings.cpp @@ -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(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 -- 2.50.1