[clang] [SYCL] The sycl_kernel_entry_point attribute. (PR #111389)

via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 7 08:01:41 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 4b4ea6d84bddb5e7b3f144d18630390755e8f7b6 3c4a2b8a52d3f1c730df88a308dece21a67834ef --extensions h,cpp -- clang/include/clang/AST/SYCLKernelInfo.h clang/test/ASTSYCL/ast-dump-sycl-kernel-entry-point.cpp clang/test/SemaSYCL/sycl-kernel-entry-point-attr-grammar.cpp clang/test/SemaSYCL/sycl-kernel-entry-point-attr-ignored.cpp clang/include/clang/AST/ASTContext.h clang/include/clang/Sema/SemaSYCL.h clang/lib/AST/ASTContext.cpp clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaSYCL.cpp clang/lib/Serialization/ASTReaderDecl.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/include/clang/AST/SYCLKernelInfo.h b/clang/include/clang/AST/SYCLKernelInfo.h
index 79a83330f1..7a88d5ec70 100644
--- a/clang/include/clang/AST/SYCLKernelInfo.h
+++ b/clang/include/clang/AST/SYCLKernelInfo.h
@@ -13,27 +13,22 @@
 #ifndef LLVM_CLANG_AST_SYCLKERNELINFO_H
 #define LLVM_CLANG_AST_SYCLKERNELINFO_H
 
-#include <string>
 #include "clang/AST/Decl.h"
 #include "clang/AST/Type.h"
+#include <string>
 
 namespace clang {
 
 class SYCLKernelInfo {
 public:
-  SYCLKernelInfo(
-      CanQualType KernelNameType,
-      const FunctionDecl *KernelEntryPointDecl)
-  :
-      KernelNameType(KernelNameType),
-      KernelEntryPointDecl(KernelEntryPointDecl)
-  {}
-
-  CanQualType GetKernelNameType() const {
-    return KernelNameType;
-  }
+  SYCLKernelInfo(CanQualType KernelNameType,
+                 const FunctionDecl *KernelEntryPointDecl)
+      : KernelNameType(KernelNameType),
+        KernelEntryPointDecl(KernelEntryPointDecl) {}
+
+  CanQualType GetKernelNameType() const { return KernelNameType; }
 
-  const FunctionDecl* GetKernelEntryPointDecl() const {
+  const FunctionDecl *GetKernelEntryPointDecl() const {
     return KernelEntryPointDecl;
   }
 
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index daf4b8398b..397cb93309 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -14299,7 +14299,7 @@ void ASTContext::getFunctionFeatureMap(llvm::StringMap<bool> &FeatureMap,
 static SYCLKernelInfo BuildSYCLKernelInfo(ASTContext &Context,
                                           CanQualType KernelNameType,
                                           const FunctionDecl *FD) {
-  return { KernelNameType, FD };
+  return {KernelNameType, FD};
 }
 
 void ASTContext::registerSYCLEntryPointFunction(FunctionDecl *FD) {
@@ -14316,8 +14316,7 @@ void ASTContext::registerSYCLEntryPointFunction(FunctionDecl *FD) {
       llvm::report_fatal_error("SYCL kernel name conflict");
   } else {
     SYCLKernels.insert_or_assign(
-        KernelNameType,
-        BuildSYCLKernelInfo(*this, KernelNameType, FD));
+        KernelNameType, BuildSYCLKernelInfo(*this, KernelNameType, FD));
   }
 }
 
diff --git a/clang/lib/Sema/SemaSYCL.cpp b/clang/lib/Sema/SemaSYCL.cpp
index a168e654ad..e7cecebae2 100644
--- a/clang/lib/Sema/SemaSYCL.cpp
+++ b/clang/lib/Sema/SemaSYCL.cpp
@@ -204,6 +204,6 @@ void SemaSYCL::handleKernelEntryPointAttr(Decl *D, const ParsedAttr &AL) {
   TypeSourceInfo *TSI = nullptr;
   (void)SemaRef.GetTypeFromParser(PT, &TSI);
   assert(TSI && "no type source info for attribute argument");
-  D->addAttr(::new (SemaRef.Context) SYCLKernelEntryPointAttr(SemaRef.Context,
-                                                              AL, TSI));
+  D->addAttr(::new (SemaRef.Context)
+                 SYCLKernelEntryPointAttr(SemaRef.Context, AL, TSI));
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/111389


More information about the cfe-commits mailing list