[clang] [HLSL] Implement `SpirvType` and `SpirvOpaqueType` (PR #134034)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 1 23:26:34 PDT 2025


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 HEAD~1 HEAD --extensions h,cpp -- clang/lib/Headers/hlsl/hlsl_spirv.h clang/include/clang-c/Index.h clang/include/clang/AST/ASTContext.h clang/include/clang/AST/ASTNodeTraverser.h clang/include/clang/AST/RecursiveASTVisitor.h clang/include/clang/AST/Type.h clang/include/clang/AST/TypeLoc.h clang/include/clang/Serialization/ASTRecordReader.h clang/include/clang/Serialization/ASTRecordWriter.h clang/lib/AST/ASTContext.cpp clang/lib/AST/ASTImporter.cpp clang/lib/AST/ASTStructuralEquivalence.cpp clang/lib/AST/ExprConstant.cpp clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/MicrosoftMangle.cpp clang/lib/AST/Type.cpp clang/lib/AST/TypePrinter.cpp clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/CGDebugInfo.h clang/lib/CodeGen/CodeGenFunction.cpp clang/lib/CodeGen/CodeGenTypes.cpp clang/lib/CodeGen/ItaniumCXXABI.cpp clang/lib/CodeGen/Targets/SPIR.cpp clang/lib/Headers/hlsl.h clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaLookup.cpp clang/lib/Sema/SemaTemplate.cpp clang/lib/Sema/SemaTemplateDeduction.cpp clang/lib/Sema/SemaType.cpp clang/lib/Sema/TreeTransform.h clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp clang/tools/libclang/CIndex.cpp clang/tools/libclang/CXType.cpp clang/utils/TableGen/ClangBuiltinTemplatesEmitter.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Headers/hlsl/hlsl_spirv.h b/clang/lib/Headers/hlsl/hlsl_spirv.h
index 8a71699a4..7e1502801 100644
--- a/clang/lib/Headers/hlsl/hlsl_spirv.h
+++ b/clang/lib/Headers/hlsl/hlsl_spirv.h
@@ -10,21 +10,21 @@
 #define _HLSL_HLSL_SPIRV_H_
 
 namespace hlsl {
-    namespace vk {
-    // template <class T> using Foo = __hlsl_spirv_t;
-    // typedef Foo
-    template <typename T, T v> struct integral_constant {
-      static constexpr T value = v;
-    };
-    
-    template <typename T> struct Literal {};
-    
-    template <uint Opcode, uint Size, uint Alignment, typename... Operands>
-    using SpirvType = __hlsl_spirv_type<Opcode, Size, Alignment, Operands...>;
-    
-    template <uint Opcode, typename... Operands>
-    using SpirvOpaqueType = __hlsl_spirv_type<Opcode, 0, 0, Operands...>;
-    } // namespace vk
-    } // namespace hlsl
+namespace vk {
+// template <class T> using Foo = __hlsl_spirv_t;
+// typedef Foo
+template <typename T, T v> struct integral_constant {
+  static constexpr T value = v;
+};
+
+template <typename T> struct Literal {};
+
+template <uint Opcode, uint Size, uint Alignment, typename... Operands>
+using SpirvType = __hlsl_spirv_type<Opcode, Size, Alignment, Operands...>;
+
+template <uint Opcode, typename... Operands>
+using SpirvOpaqueType = __hlsl_spirv_type<Opcode, 0, 0, Operands...>;
+} // namespace vk
+} // namespace hlsl
 
 #endif // _HLSL_HLSL_SPIRV_H_
\ No newline at end of file

``````````

</details>


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


More information about the cfe-commits mailing list