@@ -175,8 +175,8 @@ SourceRange getStmtExpansionSourceRange(const Stmt *S) {
175175 isInRange (SM.getExpansionRange (Range.getBegin ()).getBegin (),
176176 SM.getExpansionRange (Range.getBegin ()).getEnd (),
177177 SM.getSpellingLoc (Range.getBegin ())) &&
178- isInRange (SM.getExpansionRange (Range.getBegin ()).getBegin (),
179- SM.getExpansionRange (Range.getBegin ()).getEnd (),
178+ isInRange (SM.getExpansionRange (Range.getEnd ()).getBegin (),
179+ SM.getExpansionRange (Range.getEnd ()).getEnd (),
180180 SM.getSpellingLoc (Range.getEnd ()))) {
181181 // MACRO(callExpr())
182182 BeginLoc = SM.getSpellingLoc (Range.getBegin ());
@@ -2050,7 +2050,7 @@ getTheOneBeforeLastImmediateExapansion(const clang::SourceLocation Begin,
20502050// Line 3: #define CALL_KERNEL(C, D) KERNEL(C, D); int a = 0;
20512051// Line 4: void templatefoo2() { CALL_KERNEL(8, 9) }
20522052// There are 3 candidates of the kernel range,
2053- // 1. Line 4 "CALL_KERNEL2 (8, AAA )"
2053+ // 1. Line 4 "CALL_KERNEL (8, 9 )"
20542054// 2. Line 3 "KERNEL(C, D)"
20552055// 3. Line 2 "templatefoo<A,B>CCC"
20562056// The 3rd candidate is the best choice.
@@ -2154,7 +2154,7 @@ void traversePossibleLocations(const SourceLocation &SL,
21542154 if (!SL.isValid ())
21552155 return ;
21562156 if (Cache.find (SL.getHashValue ()) != Cache.end ())
2157- return ;
2157+ return ; // If visited, return;
21582158 Cache.insert (SL.getHashValue ());
21592159 if (!SL.isMacroID ()) {
21602160 if (isInRange (RangeBegin, RangeEnd, SL)) {
0 commit comments