[clang] d3ddc25 - Revert "[CodeGen] Keep track info of lazy-emitted symbols in ModuleBuilder"

Mitch Phillips via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 13 10:12:55 PDT 2022


Author: Mitch Phillips
Date: 2022-06-13T10:12:38-07:00
New Revision: d3ddc251acae631bf5ab4da13878f7e8b5b5a451

URL: https://github.com/llvm/llvm-project/commit/d3ddc251acae631bf5ab4da13878f7e8b5b5a451
DIFF: https://github.com/llvm/llvm-project/commit/d3ddc251acae631bf5ab4da13878f7e8b5b5a451.diff

LOG: Revert "[CodeGen] Keep track info of lazy-emitted symbols in ModuleBuilder"

This reverts commit b8f9459715815fa055b3e1c5f970c616797dfcfb.

Broke the ASan buildbot. See https://reviews.llvm.org/D126781 for more
information.

Added: 
    

Modified: 
    clang/lib/CodeGen/CodeGenModule.h
    clang/lib/CodeGen/ModuleBuilder.cpp
    clang/test/Interpreter/execute.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index b7c180f1c8859..0ac476dd6dbcc 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -1477,31 +1477,6 @@ class CodeGenModule : public CodeGenTypeCache {
   void printPostfixForExternalizedDecl(llvm::raw_ostream &OS,
                                        const Decl *D) const;
 
-  /// Move some lazily-emitted states to the NewBuilder. This is especially
-  /// essential for the incremental parsing environment like Clang Interpreter,
-  /// because we'll lose all important information after each repl.
-  void moveLazyEmissionStates(CodeGenModule *NewBuilder) {
-    assert(DeferredDeclsToEmit.empty() &&
-           "Should have emitted all decls deferred to emit.");
-    assert(NewBuilder->DeferredDecls.empty() &&
-           "Newly created module should not have deferred decls");
-    NewBuilder->DeferredDecls = std::move(DeferredDecls);
-
-    assert(NewBuilder->DeferredVTables.empty() &&
-           "Newly created module should not have deferred vtables");
-    NewBuilder->DeferredVTables = std::move(DeferredVTables);
-
-    assert(NewBuilder->MangledDeclNames.empty() &&
-           "Newly created module should not have mangled decl names");
-    assert(NewBuilder->Manglings.empty() &&
-           "Newly created module should not have manglings");
-    NewBuilder->Manglings = std::move(Manglings);
-
-    assert(WeakRefReferences.empty() &&
-           "Not all WeakRefRefs have been applied");
-    NewBuilder->TBAA = std::move(TBAA);
-  }
-
 private:
   llvm::Constant *GetOrCreateLLVMFunction(
       StringRef MangledName, llvm::Type *Ty, GlobalDecl D, bool ForVTable,

diff  --git a/clang/lib/CodeGen/ModuleBuilder.cpp b/clang/lib/CodeGen/ModuleBuilder.cpp
index 8e97a298ce7fa..50b7fd8eb993c 100644
--- a/clang/lib/CodeGen/ModuleBuilder.cpp
+++ b/clang/lib/CodeGen/ModuleBuilder.cpp
@@ -134,14 +134,7 @@ namespace {
                               llvm::LLVMContext &C) {
       assert(!M && "Replacing existing Module?");
       M.reset(new llvm::Module(ExpandModuleName(ModuleName, CodeGenOpts), C));
-
-      std::unique_ptr<CodeGenModule> OldBuilder = std::move(Builder);
-
       Initialize(*Ctx);
-
-      if (OldBuilder)
-        OldBuilder->moveLazyEmissionStates(Builder.get());
-
       return M.get();
     }
 

diff  --git a/clang/test/Interpreter/execute.cpp b/clang/test/Interpreter/execute.cpp
index 61e68990acf96..298046c068c37 100644
--- a/clang/test/Interpreter/execute.cpp
+++ b/clang/test/Interpreter/execute.cpp
@@ -13,8 +13,4 @@ struct S { float f = 1.0; S *m = nullptr;} s;
 
 auto r2 = printf("S[f=%f, m=0x%llx]\n", s.f, reinterpret_cast<unsigned long long>(s.m));
 // CHECK-NEXT: S[f=1.000000, m=0x0]
-
-inline int foo() { return 42; }
-int r3 = foo();
-
 quit


        


More information about the cfe-commits mailing list