When translating a Clang source range into a libclang source range,
adjust the a ending macro location to the end of the instantiation
location before adjusting it to the end of the token. Fixes
<rdar://problem/9021561>.
llvm-svn: 129872
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index ce02088..870e6b2 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -116,7 +116,7 @@
// location accordingly.
SourceLocation EndLoc = R.getEnd();
if (EndLoc.isValid() && EndLoc.isMacroID())
- EndLoc = SM.getSpellingLoc(EndLoc);
+ EndLoc = SM.getInstantiationRange(EndLoc).second;
if (R.isTokenRange() && !EndLoc.isInvalid() && EndLoc.isFileID()) {
unsigned Length = Lexer::MeasureTokenLength(EndLoc, SM, LangOpts);
EndLoc = EndLoc.getFileLocWithOffset(Length);