diff --git a/clang/lib/CodeGen/CGCXXABI.h b/clang/lib/CodeGen/CGCXXABI.h index a46f7f37141f..0768e6581acb 100644 --- a/clang/lib/CodeGen/CGCXXABI.h +++ b/clang/lib/CodeGen/CGCXXABI.h @@ -41,6 +41,8 @@ struct CatchTypeInfo; /// Implements C++ ABI-specific code generation functions. class CGCXXABI { + friend class CodeGenModule; + protected: CodeGenModule &CGM; std::unique_ptr MangleCtx; diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 101080b6fe13..29713a5d2b3b 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -7000,4 +7000,6 @@ void CodeGenModule::moveLazyEmissionStates(CodeGenModule *NewBuilder) { "Still have (unmerged) EmittedDeferredDecls deferred decls"); NewBuilder->EmittedDeferredDecls = std::move(EmittedDeferredDecls); + + NewBuilder->ABI->MangleCtx = std::move(ABI->MangleCtx); } diff --git a/clang/test/Interpreter/execute.cpp b/clang/test/Interpreter/execute.cpp index f5c70c21ac50..0396ad82e9b3 100644 --- a/clang/test/Interpreter/execute.cpp +++ b/clang/test/Interpreter/execute.cpp @@ -5,6 +5,7 @@ // UNSUPPORTED: system-aix // CHECK-DRIVER: i = 10 // RUN: cat %s | clang-repl | FileCheck %s +// RUN: cat %s | clang-repl -Xcc -O2 | FileCheck %s extern "C" int printf(const char *, ...); int i = 42; auto r1 = printf("i = %d\n", i);