[PATCH] D20446: clang-rename: fix renaming members when referenced as macro arguments
Manuel Klimek via cfe-commits
cfe-commits at lists.llvm.org
Fri May 20 02:52:06 PDT 2016
klimek added inline comments.
================
Comment at: clang-rename/USRLocFinder.cpp:106-113
@@ -105,3 +105,10 @@
if (getUSRForDecl(Decl) == USR) {
- LocationsFound.push_back(Expr->getMemberLoc());
+ SourceLocation Location = Expr->getMemberLoc();
+ if (Location.isMacroID()) {
+ // The location is expanded from a macro, look up the original spelling
+ // location.
+ const ASTContext &Context = Decl->getASTContext();
+ Location = Context.getSourceManager().getSpellingLoc(Location);
+ }
+ LocationsFound.push_back(Location);
}
----------------
Don't we just always want to do that?
Location = Decl->getASTContext().getSourceManager().getSpellingLoc(Expr->getMemberLoc());
should always work.
http://reviews.llvm.org/D20446
More information about the cfe-commits
mailing list