[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 30 12:34:15 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 85181788576151cc4b52d38d9b52d04f26179530 e84c90246c4bdd1f0301ce88ac9055dfa3a9c5b0 --extensions cpp,h -- clang/include/clang/AST/Type.h clang/lib/AST/ASTContext.cpp clang/lib/AST/ASTStructuralEquivalence.cpp clang/lib/AST/DeclCXX.cpp clang/lib/AST/ExprConstant.cpp clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/MicrosoftMangle.cpp clang/lib/AST/Type.cpp clang/lib/CodeGen/CodeGenFunction.cpp clang/lib/CodeGen/CodeGenTypes.cpp clang/lib/CodeGen/ItaniumCXXABI.cpp clang/lib/CodeGen/Targets/DirectX.cpp clang/lib/Sema/HLSLExternalSemaSource.cpp clang/lib/Sema/SemaLookup.cpp clang/lib/Sema/SemaOverload.cpp clang/lib/Sema/SemaTemplate.cpp clang/lib/Sema/SemaTemplateDeduction.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/Targets/DirectX.cpp b/clang/lib/CodeGen/Targets/DirectX.cpp
index a33398657f..2a9fb340cf 100644
--- a/clang/lib/CodeGen/Targets/DirectX.cpp
+++ b/clang/lib/CodeGen/Targets/DirectX.cpp
@@ -46,14 +46,14 @@ llvm::Type *DirectXTargetCodeGenInfo::getHLSLType(CodeGenModule &CGM,
     // convert element type
     llvm::Type *ElemType = CGM.getTypes().ConvertType(ContainedTy);
 
-    const char* TypeName = ResAttrs.RawBuffer ? "dx.RawBuffer" : "dx.TypedBuffer";
-    SmallVector<unsigned, 3> Ints = {
-      /*IsWriteable*/ ResAttrs.ResourceClass == llvm::dxil::ResourceClass::UAV,
-      /*IsROV*/ ResAttrs.IsROV
-    };
+    const char *TypeName =
+        ResAttrs.RawBuffer ? "dx.RawBuffer" : "dx.TypedBuffer";
+    SmallVector<unsigned, 3> Ints = {/*IsWriteable*/ ResAttrs.ResourceClass ==
+                                         llvm::dxil::ResourceClass::UAV,
+                                     /*IsROV*/ ResAttrs.IsROV};
     if (!ResAttrs.RawBuffer)
       Ints.push_back(/*IsSigned*/ ContainedTy->isSignedIntegerType());
-    
+
     return llvm::TargetExtType::get(Ctx, TypeName, {ElemType}, Ints);
   }
   case llvm::dxil::ResourceClass::CBuffer:

``````````

</details>


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


More information about the cfe-commits mailing list