Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions clang/lib/Tooling/Transformer/SourceCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,7 @@ static bool spelledInMacroDefinition(CharSourceRange Range,
return B.isInvalid() || B != E;
}

if (Range.getBegin().isMacroID())
return getMacroArgumentSpellingLoc(Range.getBegin(), SM).isInvalid();
if (Range.getEnd().isMacroID())
return getMacroArgumentSpellingLoc(Range.getEnd(), SM).isInvalid();

return false;
return Range.getBegin().isMacroID() || Range.getEnd().isMacroID();
}

// Returns the expansion char-range of `Loc` if `Loc` is a split token. For
Expand Down
2 changes: 2 additions & 0 deletions clang/unittests/Tooling/SourceCodeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,13 @@ TEST(SourceCodeTest, EditInvolvingExpansionIgnoringExpansionShouldFail) {
#define M2(x, y) x ## y
#define M3(x) foobar(x)
#define M4(x, y) x y
#define M5(x) x
int foobar(int);
int a = M1(foobar);
int b = M2(foo, bar(2));
int c = M3(3);
int d = M4(foobar, (4));
int e = M5(foobar) (5);
)cpp");

CallsVisitor Visitor;
Expand Down