From: David Majnemer Date: Thu, 12 Dec 2013 23:12:01 +0000 (+0000) Subject: [-cxx-abi microsoft] Mangle reference temporaries X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8f9f0c367aa101a4883b613e4d0a7fb2f46c0e61;p=clang [-cxx-abi microsoft] Mangle reference temporaries They are mangled the same as normal references, nothing special is going on here. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197184 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index 24eac84cdd..a02571e8a0 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -2040,10 +2040,9 @@ void MicrosoftMangleContextImpl::mangleCXXDtor(const CXXDestructorDecl *D, } void MicrosoftMangleContextImpl::mangleReferenceTemporary(const VarDecl *VD, - raw_ostream &) { - unsigned DiagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error, - "cannot mangle this reference temporary yet"); - getDiags().Report(VD->getLocation(), DiagID); + raw_ostream &Out) { + MicrosoftCXXNameMangler mangler(*this, Out); + mangler.mangle(VD); } void MicrosoftMangleContextImpl::mangleStaticGuardVariable(const VarDecl *VD, diff --git a/test/CodeGenCXX/mangle-ms.cpp b/test/CodeGenCXX/mangle-ms.cpp index 62f9831750..662234f9e6 100644 --- a/test/CodeGenCXX/mangle-ms.cpp +++ b/test/CodeGenCXX/mangle-ms.cpp @@ -445,3 +445,10 @@ decltype(a) fun(decltype(a) x, decltype(a)) { return x; } // CHECK-DAG: ?fun@PR18022@@YA?AU@1@U21@0@Z } + +// Binding to a bit-field that requires a temporary. +struct { int bitfield : 3; } object_with_bitfield = { 3 }; +const int &reference_to_bitfield = object_with_bitfield.bitfield; +// CHECK-DAG: ?object_with_bitfield@@3U@@A +// CHECK-DAG: ?reference_to_bitfield@@3ABHB +// CHECK-DAG: ??__Ereference_to_bitfield@@YAXXZ