[clang] [llvm] [HLSL] Allow resource type attributes only on __hlsl_resource_t (PR #110079)

via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 25 21:04:12 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 e7d68c903be0d813be96954b274e65e58c42e5e4 71c4a9361f07a606c95eb5232be50dcdff31c422 --extensions cpp,h -- clang/include/clang/AST/Type.h clang/include/clang/Sema/SemaHLSL.h clang/lib/AST/ASTContext.cpp clang/lib/Sema/HLSLExternalSemaSource.cpp clang/lib/Sema/SemaHLSL.cpp clang/lib/Sema/SemaType.cpp llvm/unittests/IR/IntrinsicsTest.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp
index b6bd8e778a..e295fc9ef3 100644
--- a/clang/lib/Sema/HLSLExternalSemaSource.cpp
+++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp
@@ -256,17 +256,21 @@ struct BuiltinTypeDeclBuilder {
 
     // FIXME: Placeholder to make sure we return the correct type - create
     // field of element_type and return reference to it. This field will go
-    // away once indexing into resources is properly  implemented in 
+    // away once indexing into resources is properly  implemented in
     // llvm/llvm-project#95956.
     if (Fields.count("e") == 0) {
       addMemberVariable("e", ElemTy, {});
     }
     FieldDecl *ElemFieldDecl = Fields["e"];
-        
-    auto *This = CXXThisExpr::Create(AST, SourceLocation(), MethodDecl->getFunctionObjectParameterType(),true);
-    Expr *ElemField = MemberExpr::CreateImplicit(AST, This, false, ElemFieldDecl,
-                                              ElemFieldDecl->getType(), VK_LValue,OK_Ordinary);
-    auto *Return =  ReturnStmt::Create(AST, SourceLocation(), ElemField, nullptr);
+
+    auto *This =
+        CXXThisExpr::Create(AST, SourceLocation(),
+                            MethodDecl->getFunctionObjectParameterType(), true);
+    Expr *ElemField = MemberExpr::CreateImplicit(
+        AST, This, false, ElemFieldDecl, ElemFieldDecl->getType(), VK_LValue,
+        OK_Ordinary);
+    auto *Return =
+        ReturnStmt::Create(AST, SourceLocation(), ElemField, nullptr);
 
     MethodDecl->setBody(CompoundStmt::Create(AST, {Return}, FPOptionsOverride(),
                                              SourceLocation(),

``````````

</details>


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


More information about the cfe-commits mailing list