Using the mangled name of the variable for its lifetime-extended temporaries doesn't sound right to me. Given:
int n; int &&r = +n; Clang generates: @"\01?r@@3$$QEAHEA" = global i32* null, align 8 @"\01?r@@3$$QEAHEA1" = private global i32 0, align 4 ... where the latter is the lifetime-extended temporary, with a suspicious mangling. Given: int &&r = 0; Clang asserts: Global variable initializer type does not match global variable type! i32** @"\01?r@@3$$QEAHEA" Broken module found, compilation aborted! On Thu, Dec 12, 2013 at 3:12 PM, David Majnemer <[email protected]>wrote: > Author: majnemer > Date: Thu Dec 12 17:12:01 2013 > New Revision: 197184 > > URL: http://llvm.org/viewvc/llvm-project?rev=197184&view=rev > Log: > [-cxx-abi microsoft] Mangle reference temporaries > > They are mangled the same as normal references, nothing special is going > on here. > > Modified: > cfe/trunk/lib/AST/MicrosoftMangle.cpp > cfe/trunk/test/CodeGenCXX/mangle-ms.cpp > > Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=197184&r1=197183&r2=197184&view=diff > > ============================================================================== > --- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original) > +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Thu Dec 12 17:12:01 2013 > @@ -2040,10 +2040,9 @@ void MicrosoftMangleContextImpl::mangleC > } > > 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, > > Modified: cfe/trunk/test/CodeGenCXX/mangle-ms.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms.cpp?rev=197184&r1=197183&r2=197184&view=diff > > ============================================================================== > --- cfe/trunk/test/CodeGenCXX/mangle-ms.cpp (original) > +++ cfe/trunk/test/CodeGenCXX/mangle-ms.cpp Thu Dec 12 17:12:01 2013 > @@ -445,3 +445,10 @@ decltype(a) fun(decltype(a) x, decltype( > // CHECK-DAG: ?fun@PR18022@@YA?AU<unnamed-type-a>@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<unnamed-type-object_with_bitfield>@@A > +// CHECK-DAG: ?reference_to_bitfield@@3ABHB > +// CHECK-DAG: ??__Ereference_to_bitfield@@YAXXZ > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
