Don't perform AnalysisBasedWarnings in Sema or run the static analyzer when a
fatal error has occurred.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102778 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp
index dffdf6b..6ded0a3 100644
--- a/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/lib/Sema/AnalysisBasedWarnings.cpp
@@ -345,12 +345,14 @@
   //     don't bother trying.
   // (2) The code already has problems; running the analysis just takes more
   //     time.
-  if (S.getDiagnostics().hasErrorOccurred())
+  Diagnostic &Diags = S.getDiagnostics();
+
+  if (Diags.hasErrorOccurred() || Diags.hasFatalErrorOccurred())
     return;
 
   // Do not do any analysis for declarations in system headers if we are
   // going to just ignore them.
-  if (S.getDiagnostics().getSuppressSystemWarnings() &&
+  if (Diags.getSuppressSystemWarnings() &&
       S.SourceMgr.isInSystemHeader(D->getLocation()))
     return;