Skip to content

Commit b8f79f8

Browse files
authored
[Clang][Attr] Fix possible crash when trying to check for DeviceKernel spelling (#143546)
I didn't add a test because this can't be reproduced yet in this repo, I reproduced this only in intel's fork with more SYCL support. I also fixed some formatting. Signed-off-by: Sarnie, Nick <[email protected]>
1 parent 766b301 commit b8f79f8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,11 +1612,11 @@ def DeviceKernel : DeclOrTypeAttr {
16121612
// list, but here we have the same spelling with unscores and without,
16131613
// so handle that case manually.
16141614
return A.getAttributeSpellingListIndex() == Keyword_kernel ||
1615-
A.getAttrName()->getName() == "kernel";
1615+
(A.getAttrName() && A.getAttrName()->getName() == "kernel");
16161616
}
16171617
static inline bool isOpenCLSpelling(const AttributeCommonInfo* A) {
1618-
if (!A) return false;
1619-
return isOpenCLSpelling(*A);
1618+
if (!A) return false;
1619+
return isOpenCLSpelling(*A);
16201620
}
16211621
}];
16221622
}

0 commit comments

Comments
 (0)