Skip to content

Commit c8c7e97

Browse files
authored
[SYCLomatic] Small update for macro utility functions (#2448)
Signed-off-by: Jiang, Zhiwei <[email protected]>
1 parent 6212331 commit c8c7e97

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

clang/lib/DPCT/RuleInfra/ExprAnalysis.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,8 +785,6 @@ class ArgumentAnalysis : public ExprAnalysis {
785785
// constructor and no migration for it. Start analyzing its argument.
786786
// Replace total string when it is default argument expression.
787787
void initArgumentExpr(const Expr *Expression) {
788-
if (!Expression)
789-
initExpression(Expression);
790788
if (auto Ctor = dyn_cast<CXXConstructExpr>(Expression)) {
791789
if (Ctor->getParenOrBraceRange().isInvalid() && Ctor->getNumArgs() == 1)
792790
Expression = Ctor->getArg(0);

clang/lib/DPCT/Utility.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)