-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL][NFC] Fix static code analysis concerns #2531
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3215,8 +3215,12 @@ static void adjustDeclContextForDeclaratorDecl(DeclaratorDecl *NewD, | |
template <typename AttributeType> | ||
static void checkDimensionsAndSetDiagnostics(Sema &S, FunctionDecl *New, | ||
FunctionDecl *Old) { | ||
AttributeType *NewDeclAttr = New->getAttr<AttributeType>(); | ||
AttributeType *OldDeclAttr = Old->getAttr<AttributeType>(); | ||
const auto *NewDeclAttr = New->getAttr<AttributeType>(); | ||
elizabethandrews marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const auto *OldDeclAttr = Old->getAttr<AttributeType>(); | ||
|
||
if (!NewDeclAttr || !OldDeclAttr) | ||
return; | ||
|
||
if ((NewDeclAttr->getXDim() != OldDeclAttr->getXDim()) || | ||
(NewDeclAttr->getYDim() != OldDeclAttr->getYDim()) || | ||
(NewDeclAttr->getZDim() != OldDeclAttr->getZDim())) { | ||
|
@@ -3302,12 +3306,8 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, | |
} | ||
} | ||
|
||
if (New->hasAttr<ReqdWorkGroupSizeAttr>() && | ||
Old->hasAttr<ReqdWorkGroupSizeAttr>()) | ||
checkDimensionsAndSetDiagnostics<ReqdWorkGroupSizeAttr>(*this, New, Old); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand this is what @erichkeane suggested earlier, but I am not sure I like this. Would we do this for every attribute we want to merge? Seems like a lot of wasted calls. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it ends up being basically the same runtime-cost here after optimization. It seems like an easy function to inline, and hasAttr and getAttr have identical runtime cost. My fear here is that this ends up being REALLY error-prone as time goes on, we're going to be adding these for a handful of attributes and it becomes easy to copy/paste error the THREE uses of the attribute type. |
||
|
||
if (New->hasAttr<SYCLIntelMaxWorkGroupSizeAttr>() && | ||
Old->hasAttr<SYCLIntelMaxWorkGroupSizeAttr>()) | ||
checkDimensionsAndSetDiagnostics<SYCLIntelMaxWorkGroupSizeAttr>(*this, New, | ||
Old); | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.