================
@@ -1062,8 +1062,25 @@ void CodeGenModule::checkAliases() {
 
 void CodeGenModule::clear() {
   DeferredDeclsToEmit.clear();
+  if (Context.getLangOpts().IncrementalExtensions) {
+    // The next input starts a new module. It can still emit the deferred decls
+    // of the earlier inputs, but not those of the failed unit.
+    DeferredDecls.insert_range(EmittedDeferredDecls);
+    const TranslationUnitDecl *TU = Context.getTranslationUnitDecl();
+    auto InFailedUnit = [TU](const Decl *D) {
+      return D->getTranslationUnitDecl() == TU;
+    };
+    SmallVector<StringRef, 8> Dropped;
----------------
jaredwy wrote:

Although wouldn't a better approach be to simple not add them into the list if 
we fail? 

https://github.com/llvm/llvm-project/pull/226285
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to