Don't bother running the analysis for CFG-based warnings if the

declaration is in a system header.

llvm-svn: 99087
This commit is contained in:
Ted Kremenek 2010-03-20 21:11:09 +00:00
parent 918fe8498d
commit b45ebee521
1 changed files with 7 additions and 0 deletions

View 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