summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-01-30 05:01:23 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-01-30 05:01:23 +0000
commit8c969eaf1ad58dd96c77cee20ba2525d4d061a2e (patch)
tree791715ab0a2c3d9ad57bc1781945efcc09569a8f /clang/lib/Sema
parentd004586faa4383c0ce38da642bc1ce9d5500afc8 (diff)
downloadbcm5719-llvm-8c969eaf1ad58dd96c77cee20ba2525d4d061a2e.tar.gz
bcm5719-llvm-8c969eaf1ad58dd96c77cee20ba2525d4d061a2e.zip
Sema: Disable template instantiation once a fatal error is raised
Fatal errors disable all further diagnostics. Continuing to permit template instantiation does nothing but make it take longer for clang to finish with the TU. Instead, halt all further instantiation. Fixed in PR22396. llvm-svn: 227556
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiate.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 6ac7175cf30..ed0d5a54e80 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -207,6 +207,12 @@ void Sema::InstantiatingTemplate::Initialize(
sema::TemplateDeductionInfo *DeductionInfo) {
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()) {
+ Invalid = true;
+ return;
+ }
Invalid = CheckInstantiationDepth(PointOfInstantiation, InstantiationRange);
if (!Invalid) {
ActiveTemplateInstantiation Inst;
OpenPOWER on IntegriCloud