forked from OSchip/llvm-project
[MS ABI] Invent a mangling for reference temporaries
MSVC is non-conforming and doesn't have a mangling for these. Invent our own to unblock folks using clang. This fixes PR25795. llvm-svn: 256589
This commit is contained in:
parent
90bee6354d
commit
e77de75d7e
|
@ -2760,12 +2760,12 @@ void MicrosoftMangleContextImpl::mangleCXXDtor(const CXXDestructorDecl *D,
|
|||
mangler.mangle(D);
|
||||
}
|
||||
|
||||
void MicrosoftMangleContextImpl::mangleReferenceTemporary(const VarDecl *VD,
|
||||
unsigned,
|
||||
raw_ostream &) {
|
||||
unsigned DiagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error,
|
||||
"cannot mangle this reference temporary yet");
|
||||
getDiags().Report(VD->getLocation(), DiagID);
|
||||
void MicrosoftMangleContextImpl::mangleReferenceTemporary(
|
||||
const VarDecl *VD, unsigned ManglingNumber, raw_ostream &Out) {
|
||||
MicrosoftCXXNameMangler Mangler(*this, Out);
|
||||
|
||||
Mangler.getStream() << "\01?$RT" << ManglingNumber << '@';
|
||||
Mangler.mangle(VD, "");
|
||||
}
|
||||
|
||||
void MicrosoftMangleContextImpl::mangleThreadSafeStaticGuardVariable(
|
||||
|
|
|
@ -21,6 +21,10 @@ int _c(void) {return N::anonymous + c;}
|
|||
// CHECK-DAG: @"\01?_c@@YAHXZ"
|
||||
// X64-DAG: @"\01?_c@@YAHXZ"
|
||||
|
||||
const int &NeedsReferenceTemporary = 2;
|
||||
// CHECK-DAG: @"\01?NeedsReferenceTemporary@@3ABHB" = constant i32* @"\01?$RT1@NeedsReferenceTemporary@@3ABHB"
|
||||
// X64-DAG: @"\01?NeedsReferenceTemporary@@3AEBHEB" = constant i32* @"\01?$RT1@NeedsReferenceTemporary@@3AEBHEB"
|
||||
|
||||
class foo {
|
||||
static const short d;
|
||||
// CHECK-DAG: @"\01?d@foo@@0FB"
|
||||
|
|
Loading…
Reference in New Issue