[clang] 5ea647d - [CodeGen] Assert that EmittedDeferredDecls is empty

Jonas Hahnfeld via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 31 04:40:46 PDT 2023


Author: Jonas Hahnfeld
Date: 2023-07-31T13:40:00+02:00
New Revision: 5ea647dea6355304b641bf7bc407db497c6d9d21

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

LOG: [CodeGen] Assert that EmittedDeferredDecls is empty

Its contents are transferred into DeferredDecls in Release(), so it
should be empty in moveLazyEmissionStates(). This matches the code
downstream in Cling.

Differential Revision: https://reviews.llvm.org/D156660

Added: 
    

Modified: 
    clang/lib/CodeGen/CodeGenModule.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 80c7ecedc28755..8d2abc69c330e7 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -7455,6 +7455,8 @@ void CodeGenModule::moveLazyEmissionStates(CodeGenModule *NewBuilder) {
   assert(NewBuilder->DeferredDecls.empty() &&
          "Newly created module should not have deferred decls");
   NewBuilder->DeferredDecls = std::move(DeferredDecls);
+  assert(EmittedDeferredDecls.empty() &&
+         "Still have (unmerged) EmittedDeferredDecls deferred decls");
 
   assert(NewBuilder->DeferredVTables.empty() &&
          "Newly created module should not have deferred vtables");
@@ -7470,10 +7472,5 @@ void CodeGenModule::moveLazyEmissionStates(CodeGenModule *NewBuilder) {
 
   NewBuilder->TBAA = std::move(TBAA);
 
-  assert(NewBuilder->EmittedDeferredDecls.empty() &&
-         "Still have (unmerged) EmittedDeferredDecls deferred decls");
-
-  NewBuilder->EmittedDeferredDecls = std::move(EmittedDeferredDecls);
-
   NewBuilder->ABI->MangleCtx = std::move(ABI->MangleCtx);
 }


        


More information about the cfe-commits mailing list