[PATCH] D125944: Template instantiation error recovery

Purva Chaudhari via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 29 10:51:59 PDT 2022


Purva-Chaudhari updated this revision to Diff 441079.
Purva-Chaudhari added a comment.

Updating


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125944/new/

https://reviews.llvm.org/D125944

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Interpreter/IncrementalParser.cpp


Index: clang/include/clang/Sema/Sema.h
===================================================================
--- clang/include/clang/Sema/Sema.h
+++ clang/include/clang/Sema/Sema.h
@@ -9456,6 +9456,19 @@
         SavedPendingLocalImplicitInstantiations;
   };
 
+  class PerformPendingInstantiationsRAII {
+  public:
+    PerformPendingInstantiationsRAII(Sema &S): S(S) {} ;
+
+    ~PerformPendingInstantiationsRAII() {
+      S.PerformPendingInstantiations();
+      assert(S.PendingInstantiations.empty() &&
+             "there shouldn't be any pending instantiations");
+    }
+  private:
+    Sema &S;
+  };
+
   /// A helper class for building up ExtParameterInfos.
   class ExtParameterInfoBuilder {
     SmallVector<FunctionProtoType::ExtParameterInfo, 16> Infos;
Index: clang/lib/Interpreter/IncrementalParser.cpp
===================================================================
--- clang/lib/Interpreter/IncrementalParser.cpp
+++ clang/lib/Interpreter/IncrementalParser.cpp
@@ -177,6 +177,7 @@
   }
 
   DiagnosticsEngine &Diags = getCI()->getDiagnostics();
+  Sema::PerformPendingInstantiationsRAII PerformPendingInstantiations(S);
   if (Diags.hasErrorOccurred()) {
     TranslationUnitDecl *MostRecentTU = C.getTranslationUnitDecl();



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125944.441079.patch
Type: text/x-patch
Size: 1249 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220629/34a1ea88/attachment-0001.bin>


More information about the cfe-commits mailing list