ogoffart created this revision. Do not perform the analysis based warning if all warnings are ignored.
This saves some cycles when compiling with "-w". But more importantly, for my tool, this fixes a potential crash which may happen on invalid code. Because the 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. But the tool is better at recovering and hit this condition. https://reviews.llvm.org/D40242 Files: lib/Sema/AnalysisBasedWarnings.cpp Index: lib/Sema/AnalysisBasedWarnings.cpp =================================================================== --- lib/Sema/AnalysisBasedWarnings.cpp +++ lib/Sema/AnalysisBasedWarnings.cpp @@ -2080,10 +2080,10 @@ // 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.
Index: lib/Sema/AnalysisBasedWarnings.cpp =================================================================== --- lib/Sema/AnalysisBasedWarnings.cpp +++ lib/Sema/AnalysisBasedWarnings.cpp @@ -2080,10 +2080,10 @@ // 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.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits