[NFC] Move function definition to cpp file

Signed-off-by: Jun Zhang <jun@junz.org>
This commit is contained in:
Jun Zhang 2022-07-23 12:29:18 +08:00
parent 6b7eae11f1
commit 1a3a2eec71
No known key found for this signature in database
GPG Key ID: E19904830B621534
2 changed files with 29 additions and 28 deletions

View File

@ -6973,3 +6973,31 @@ void CodeGenModule::printPostfixForExternalizedDecl(llvm::raw_ostream &OS,
OS << getContext().getCUIDHash();
}
}
void CodeGenModule::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->WeakRefReferences = std::move(WeakRefReferences);
NewBuilder->TBAA = std::move(TBAA);
assert(NewBuilder->EmittedDeferredDecls.empty() &&
"Still have (unmerged) EmittedDeferredDecls deferred decls");
NewBuilder->EmittedDeferredDecls = std::move(EmittedDeferredDecls);
}

View File

@ -1514,34 +1514,7 @@ public:
/// 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->WeakRefReferences = std::move(WeakRefReferences);
NewBuilder->TBAA = std::move(TBAA);
assert(NewBuilder->EmittedDeferredDecls.empty() &&
"Still have (unmerged) EmittedDeferredDecls deferred decls");
NewBuilder->EmittedDeferredDecls = std::move(EmittedDeferredDecls);
}
void moveLazyEmissionStates(CodeGenModule *NewBuilder);
private:
llvm::Constant *GetOrCreateLLVMFunction(