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.

llvm-svn: 199764
This commit is contained in:
David Majnemer 2014-01-21 20:33:36 +00:00
parent 3e4a34c8c3
commit b9a5f2d3b6
2 changed files with 6 additions and 1 deletions

View File

@ -345,7 +345,7 @@ void MicrosoftCXXNameMangler::mangleVariableEncoding(const VarDecl *VD) {
// 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(const UnaryTransformType *T,
}
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");

View File

@ -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@Z"
void LRef(int& a) { }