forked from OSchip/llvm-project
[CodeGen] Consider MangleCtx when move lazy emission States
Also move MangleCtx when moving some lazy emission states in CodeGenModule. Without this patch clang-repl hits an invalid address access when passing `-Xcc -O2` flag. Signed-off-by: Jun Zhang <jun@junz.org> Differential Revision: https://reviews.llvm.org/D130420
This commit is contained in:
parent
cd953e4ffc
commit
58c9480845
|
@ -41,6 +41,8 @@ struct CatchTypeInfo;
|
||||||
|
|
||||||
/// Implements C++ ABI-specific code generation functions.
|
/// Implements C++ ABI-specific code generation functions.
|
||||||
class CGCXXABI {
|
class CGCXXABI {
|
||||||
|
friend class CodeGenModule;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CodeGenModule &CGM;
|
CodeGenModule &CGM;
|
||||||
std::unique_ptr<MangleContext> MangleCtx;
|
std::unique_ptr<MangleContext> MangleCtx;
|
||||||
|
|
|
@ -7000,4 +7000,6 @@ void CodeGenModule::moveLazyEmissionStates(CodeGenModule *NewBuilder) {
|
||||||
"Still have (unmerged) EmittedDeferredDecls deferred decls");
|
"Still have (unmerged) EmittedDeferredDecls deferred decls");
|
||||||
|
|
||||||
NewBuilder->EmittedDeferredDecls = std::move(EmittedDeferredDecls);
|
NewBuilder->EmittedDeferredDecls = std::move(EmittedDeferredDecls);
|
||||||
|
|
||||||
|
NewBuilder->ABI->MangleCtx = std::move(ABI->MangleCtx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
// UNSUPPORTED: system-aix
|
// UNSUPPORTED: system-aix
|
||||||
// CHECK-DRIVER: i = 10
|
// CHECK-DRIVER: i = 10
|
||||||
// RUN: cat %s | clang-repl | FileCheck %s
|
// RUN: cat %s | clang-repl | FileCheck %s
|
||||||
|
// RUN: cat %s | clang-repl -Xcc -O2 | FileCheck %s
|
||||||
extern "C" int printf(const char *, ...);
|
extern "C" int printf(const char *, ...);
|
||||||
int i = 42;
|
int i = 42;
|
||||||
auto r1 = printf("i = %d\n", i);
|
auto r1 = printf("i = %d\n", i);
|
||||||
|
|
Loading…
Reference in New Issue