summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiate.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2016-11-03 15:04:58 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2016-11-03 15:04:58 +0000
commit43556c14fe5ab356a17519f6f3da68f18450df47 (patch)
tree22043ca642fb93c98fa03e7d895fe42f91571a18 /clang/lib/Sema/SemaTemplateInstantiate.cpp
parent212b93d816260fca2f4129a3224647e52e5b3354 (diff)
downloadbcm5719-llvm-43556c14fe5ab356a17519f6f3da68f18450df47.tar.gz
bcm5719-llvm-43556c14fe5ab356a17519f6f3da68f18450df47.zip
[Sema] Avoid instantiating templates only when UncompilableErrorOccurred
and FatalErrorOccurred are both set. This fixes a crash that occurs when a warning promoted to a fatal error leaves the AST in an incomplete state, and then later CFG analysis is run on the incomplete AST. rdar://problem/28558923 Differential Revision: https://reviews.llvm.org/D26166 llvm-svn: 285923
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiate.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index b715c13b077..6e715d25b4d 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -209,9 +209,11 @@ Sema::InstantiatingTemplate::InstantiatingTemplate(
sema::TemplateDeductionInfo *DeductionInfo)
: SemaRef(SemaRef), SavedInNonInstantiationSFINAEContext(
SemaRef.InNonInstantiationSFINAEContext) {
- // Don't allow further instantiation if a fatal error has occcured. Any
- // diagnostics we might have raised will not be visible.
- if (SemaRef.Diags.hasFatalErrorOccurred()) {
+ // Don't allow further instantiation if a fatal error and an uncompilable
+ // error have occcured. Any diagnostics we might have raised will not be
+ // visible, and we do not need to construct a correct AST.
+ if (SemaRef.Diags.hasFatalErrorOccurred() &&
+ SemaRef.Diags.hasUncompilableErrorOccurred()) {
Invalid = true;
return;
}
OpenPOWER on IntegriCloud