summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2017-11-23 08:15:22 +0000
committerOlivier Goffart <ogoffart@woboq.com>2017-11-23 08:15:22 +0000
commit270ced2bce385d69fa16d16a3bfc90eb90ab396d (patch)
tree91edccdc9bcc419cb1a177b4fbb20d0c7e32afeb /clang/lib
parent33894b619b89e0ab686bcc5701364ddaf47435d6 (diff)
downloadbcm5719-llvm-270ced2bce385d69fa16d16a3bfc90eb90ab396d.tar.gz
bcm5719-llvm-270ced2bce385d69fa16d16a3bfc90eb90ab396d.zip
Do not perform the analysis based warning if the warnings are ignored
This saves some cycles when compiling with "-w". (Also fix a potential crash on invalid code for tools that tries to recover from some errors, because analysis might compute the CFG which crashes if the code contains invalid declaration. This does not happen normally with because we also don't perform these analysis if there was an error.) Differential Revision: https://reviews.llvm.org/D40242 llvm-svn: 318900
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/AnalysisBasedWarnings.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp
index f004a990a42..c5b4eb27f90 100644
--- a/clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -2080,10 +2080,10 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P,
// time.
DiagnosticsEngine &Diags = S.getDiagnostics();
- // Do not do any analysis for declarations in system headers if we are
- // going to just ignore them.
- if (Diags.getSuppressSystemWarnings() &&
- S.SourceMgr.isInSystemHeader(D->getLocation()))
+ // Do not do any analysis if we are going to just ignore them.
+ if (Diags.getIgnoreAllWarnings() ||
+ (Diags.getSuppressSystemWarnings() &&
+ S.SourceMgr.isInSystemHeader(D->getLocation())))
return;
// For code in dependent contexts, we'll do this at instantiation time.
OpenPOWER on IntegriCloud