Skip to content

Commit

Permalink
Don't go through the TypeSourceInfo when getting the SourceRange.
Browse files Browse the repository at this point in the history
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

llvm-svn: 211667
  • Loading branch information
Zachary Turner committed Jun 25, 2014
1 parent c00d875 commit 87422d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clang/lib/AST/MicrosoftMangle.cpp
Expand Up @@ -418,11 +418,11 @@ void MicrosoftCXXNameMangler::mangleVariableEncoding(const VarDecl *VD) {
// ::= <type> <pointee-cvr-qualifiers> # 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<MemberPointerType>()) {
Expand All @@ -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);
}
}
Expand Down

0 comments on commit 87422d9

Please sign in to comment.