[clang] [SYCL] Basic diagnostics for the sycl_kernel_entry_point attribute. (PR #120327)
Tom Honermann via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 18 11:15:50 PST 2024
================
@@ -206,3 +208,124 @@ void SemaSYCL::handleKernelEntryPointAttr(Decl *D, const ParsedAttr &AL) {
D->addAttr(::new (SemaRef.Context)
SYCLKernelEntryPointAttr(SemaRef.Context, AL, TSI));
}
+
+static SourceLocation SourceLocationForType(QualType QT) {
+ SourceLocation Loc;
+ const Type *T = QT->getUnqualifiedDesugaredType();
+ if (const TagType *TT = dyn_cast<TagType>(T))
+ Loc = TT->getDecl()->getLocation();
+ else if (const ObjCInterfaceType *ObjCIT = dyn_cast<ObjCInterfaceType>(T))
+ Loc = ObjCIT->getDecl()->getLocation();
+ return Loc;
----------------
tahonermann wrote:
No, it is intentional that an invalid source location be returned if there is no source location for the type (e.g., for `int`). I think the above covers all (non-alias) types that can be user declared. I could add comments to better explain the intent for this function; I'll do that.
https://github.com/llvm/llvm-project/pull/120327
More information about the cfe-commits
mailing list