[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 <nick.sarnie@intel.com>
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td
index bd07bb1..b8e5806 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -1612,11 +1612,11 @@
// list, but here we have the same spelling with unscores and without,
// so handle that case manually.
return A.getAttributeSpellingListIndex() == Keyword_kernel ||
- A.getAttrName()->getName() == "kernel";
+ (A.getAttrName() && A.getAttrName()->getName() == "kernel");
}
static inline bool isOpenCLSpelling(const AttributeCommonInfo* A) {
- if (!A) return false;
- return isOpenCLSpelling(*A);
+ if (!A) return false;
+ return isOpenCLSpelling(*A);
}
}];
}