From: Zachary Turner Date: Wed, 25 Jun 2014 05:37:25 +0000 (+0000) Subject: Don't go through the TypeSourceInfo when getting the SourceRange. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e74fa2a6cd5e37067db371fbffd7f6c9e7491b61;p=clang Don't go through the TypeSourceInfo when getting the SourceRange. VarDecl provides a method getSourceRange(), which provides a more robust way of getting the SourceRange since the TypeSourceInfo can be null in certain cases. Reviewed by: majnemer Differential Revision: http://reviews.llvm.org/D4281 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211667 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index 33b8169391..c2c8da95c6 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -418,11 +418,11 @@ void MicrosoftCXXNameMangler::mangleVariableEncoding(const VarDecl *VD) { // ::= # pointers, references // 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(); + SourceRange SR = VD->getSourceRange(); QualType Ty = VD->getType(); if (Ty->isPointerType() || Ty->isReferenceType() || Ty->isMemberPointerType()) { - mangleType(Ty, TL.getSourceRange(), QMM_Drop); + mangleType(Ty, SR, QMM_Drop); manglePointerExtQualifiers( Ty.getDesugaredType(getASTContext()).getLocalQualifiers(), nullptr); if (const MemberPointerType *MPT = Ty->getAs()) { @@ -440,7 +440,7 @@ void MicrosoftCXXNameMangler::mangleVariableEncoding(const VarDecl *VD) { else mangleQualifiers(Ty.getQualifiers(), false); } else { - mangleType(Ty, TL.getSourceRange(), QMM_Drop); + mangleType(Ty, SR, QMM_Drop); mangleQualifiers(Ty.getLocalQualifiers(), false); } }