Pass mangled name to CodeGenerator::forgetDecl. From Roman Zulak and me.
Ignore mangling errors on Windows; fixes -Xclang -verify on Windows.
This commit is contained in:
parent
0d42a482e0
commit
fa6d32fe73
@ -10,6 +10,9 @@
|
||||
#include "DeclUnloader.h"
|
||||
|
||||
#include "cling/Utils/AST.h"
|
||||
#ifdef LLVM_ON_WIN32
|
||||
#include "cling/Utils/Diagnostics.h"
|
||||
#endif
|
||||
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/DeclContextInternals.h"
|
||||
@ -837,8 +840,21 @@ bool DeclUnloader::VisitRedeclarable(clang::Redeclarable<T>* R, DeclContext* DC)
|
||||
// getting out of sync.
|
||||
//
|
||||
if (m_CurTransaction->getState() == Transaction::kCommitted) {
|
||||
|
||||
std::string mangledName;
|
||||
utils::Analyze::maybeMangleDeclName(GD, mangledName);
|
||||
{
|
||||
#if LLVM_ON_WIN32
|
||||
// clang cannot mangle everything in the ms-abi.
|
||||
#ifndef NDEBUG
|
||||
utils::DiagnosticsStore Errors(m_Sema->getDiagnostics(), false, false);
|
||||
assert(Errors.empty() || (Errors.size() == 1 &&
|
||||
Errors[0].getMessage().startswith("cannot mangle this")));
|
||||
#else
|
||||
utils::DiagnosticsOverride IgnoreMangleErrors(m_Sema->getDiagnostics());
|
||||
#endif
|
||||
#endif
|
||||
utils::Analyze::maybeMangleDeclName(GD, mangledName);
|
||||
}
|
||||
|
||||
// Handle static locals. void func() { static int var; } is represented
|
||||
// in the llvm::Module is a global named @func.var
|
||||
@ -857,7 +873,7 @@ bool DeclUnloader::VisitRedeclarable(clang::Redeclarable<T>* R, DeclContext* DC)
|
||||
GlobalValueEraser GVEraser(m_CodeGen);
|
||||
GVEraser.EraseGlobalValue(GV);
|
||||
}
|
||||
m_CodeGen->forgetDecl(GD);
|
||||
m_CodeGen->forgetDecl(GD, mangledName);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user