r199764 - MSVC ABI: Support C++11's auto on variables
David Majnemer
david.majnemer at gmail.com
Tue Jan 21 12:33:36 PST 2014
Author: majnemer
Date: Tue Jan 21 14:33:36 2014
New Revision: 199764
URL: http://llvm.org/viewvc/llvm-project?rev=199764&view=rev
Log:
MSVC ABI: Support C++11's auto on variables
The MSVC C++ ABI always uses the deduced type in place of auto when
generating external names for variables.
N.B. MSVC doesn't support C++1y's 'operator auto' and this patch will
not give us said functionality.
Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=199764&r1=199763&r2=199764&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Tue Jan 21 14:33:36 2014
@@ -345,7 +345,7 @@ void MicrosoftCXXNameMangler::mangleVari
// Pointers and references are odd. The type of 'int * const foo;' gets
// mangled as 'QAHA' instead of 'PAHB', for example.
TypeLoc TL = VD->getTypeSourceInfo()->getTypeLoc();
- QualType Ty = TL.getType();
+ QualType Ty = VD->getType();
if (Ty->isPointerType() || Ty->isReferenceType() ||
Ty->isMemberPointerType()) {
mangleType(Ty, TL.getSourceRange(), QMM_Drop);
@@ -1803,6 +1803,8 @@ void MicrosoftCXXNameMangler::mangleType
}
void MicrosoftCXXNameMangler::mangleType(const AutoType *T, SourceRange Range) {
+ assert(T->getDeducedType().isNull() && "expecting a dependent type!");
+
DiagnosticsEngine &Diags = Context.getDiags();
unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
"cannot mangle this 'auto' type yet");
Modified: cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp?rev=199764&r1=199763&r2=199764&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp Tue Jan 21 14:33:36 2014
@@ -1,5 +1,8 @@
// RUN: %clang_cc1 -std=c++11 -fms-extensions -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
+// CHECK: "\01?DeducedType@@3HA"
+auto DeducedType = 30;
+
// CHECK: "\01?LRef@@YAXAAH at Z"
void LRef(int& a) { }
More information about the cfe-commits
mailing list