Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCLomatic] Small update for macro utility functions #2448

Merged
merged 13 commits into from
Nov 14, 2024
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
2 changes: 0 additions & 2 deletions clang/lib/DPCT/RuleInfra/ExprAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,6 @@ class ArgumentAnalysis : public ExprAnalysis {
// constructor and no migration for it. Start analyzing its argument.
// Replace total string when it is default argument expression.
void initArgumentExpr(const Expr *Expression) {
if (!Expression)
initExpression(Expression);
if (auto Ctor = dyn_cast<CXXConstructExpr>(Expression)) {
if (Ctor->getParenOrBraceRange().isInvalid() && Ctor->getNumArgs() == 1)
Expression = Ctor->getArg(0);
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/DPCT/Utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ SourceRange getStmtExpansionSourceRange(const Stmt *S) {
isInRange(SM.getExpansionRange(Range.getBegin()).getBegin(),
SM.getExpansionRange(Range.getBegin()).getEnd(),
SM.getSpellingLoc(Range.getBegin())) &&
isInRange(SM.getExpansionRange(Range.getBegin()).getBegin(),
SM.getExpansionRange(Range.getBegin()).getEnd(),
isInRange(SM.getExpansionRange(Range.getEnd()).getBegin(),
SM.getExpansionRange(Range.getEnd()).getEnd(),
SM.getSpellingLoc(Range.getEnd()))) {
// MACRO(callExpr())
BeginLoc = SM.getSpellingLoc(Range.getBegin());
Expand Down Expand Up @@ -2176,7 +2176,7 @@ getTheOneBeforeLastImmediateExapansion(const clang::SourceLocation Begin,
// Line 3: #define CALL_KERNEL(C, D) KERNEL(C, D); int a = 0;
// Line 4: void templatefoo2() { CALL_KERNEL(8, 9) }
// There are 3 candidates of the kernel range,
// 1. Line 4 "CALL_KERNEL2(8, AAA)"
// 1. Line 4 "CALL_KERNEL(8, 9)"
// 2. Line 3 "KERNEL(C, D)"
// 3. Line 2 "templatefoo<A,B>CCC"
// The 3rd candidate is the best choice.
Expand Down Expand Up @@ -2280,7 +2280,7 @@ void traversePossibleLocations(const SourceLocation &SL,
if (!SL.isValid())
return;
if (Cache.find(SL.getHashValue()) != Cache.end())
return;
return; // If visited, return;
Cache.insert(SL.getHashValue());
if (!SL.isMacroID()) {
if (isInRange(RangeBegin, RangeEnd, SL)) {
Expand Down