r227556 - Sema: Disable template instantiation once a fatal error is raised

David Majnemer david.majnemer at gmail.com
Thu Jan 29 21:01:23 PST 2015


Author: majnemer
Date: Thu Jan 29 23:01:23 2015
New Revision: 227556

URL: http://llvm.org/viewvc/llvm-project?rev=227556&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=227556&r1=227555&r2=227556&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Thu Jan 29 23:01:23 2015
@@ -207,6 +207,12 @@ void Sema::InstantiatingTemplate::Initia
     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;





More information about the cfe-commits mailing list