Author: Nick Sarnie
Date: 2025-06-10T20:05:53Z
New Revision: b8f79f81a3fb559f93b30e1aef07cc965d2bf2b3

URL: 
https://github.com/llvm/llvm-project/commit/b8f79f81a3fb559f93b30e1aef07cc965d2bf2b3
DIFF: 
https://github.com/llvm/llvm-project/commit/b8f79f81a3fb559f93b30e1aef07cc965d2bf2b3.diff

LOG: [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.sar...@intel.com>

Added: 
    

Modified: 
    clang/include/clang/Basic/Attr.td

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index bd07bb1361a85..b8e5806d3c5e9 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -1612,11 +1612,11 @@ def DeviceKernel : DeclOrTypeAttr {
     // 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);
     }
 }];
 }


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to