[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 26 22:54:40 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 0ef8e71874e128560fdc77b6234d1bef3e18d3bd 87a7e6ffe84e63e1522320ae4afe9aa35cd2c502 --extensions cpp,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/Sema/SemaHLSL.h clang/lib/AST/ASTContext.cpp clang/lib/AST/ASTImporter.cpp clang/lib/AST/ASTStructuralEquivalence.cpp clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/TypeLoc.cpp clang/lib/AST/TypePrinter.cpp clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/CodeGenFunction.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaHLSL.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
``````````

</details>

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

``````````diff
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index ca6b6832d5..f9da675aa7 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -6159,7 +6159,7 @@ class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode {
 public:
   struct Attributes {
     // This is where data gathered from HLSL resource attributes are stored,
-    // such as resource class, is_rov, dimension, is_array, is_feedback 
+    // such as resource class, is_rov, dimension, is_array, is_feedback
     // or is_multisample. The values will be accessed individually via fields
     // on the embedded struct. The Data alias is used for the AST type
     //  serialization.
diff --git a/clang/include/clang/AST/TypeLoc.h b/clang/include/clang/AST/TypeLoc.h
index 8e323f9105..5db39eb3ae 100644
--- a/clang/include/clang/AST/TypeLoc.h
+++ b/clang/include/clang/AST/TypeLoc.h
@@ -953,7 +953,9 @@ public:
   TypeLoc getWrappedLoc() const { return getInnerTypeLoc(); }
   void setSourceRange(const SourceRange &R) { getLocalData()->Range = R; }
   SourceRange getLocalSourceRange() const { return getLocalData()->Range; }
-  void initializeLocal(ASTContext &Context, SourceLocation loc) { setSourceRange(SourceRange()); }
+  void initializeLocal(ASTContext &Context, SourceLocation loc) {
+    setSourceRange(SourceRange());
+  }
   QualType getInnerType() const { return getTypePtr()->getWrappedType(); }
 };
 
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 387389c23e..b96acdef70 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -5788,8 +5788,10 @@ static void fillAttributedTypeLoc(AttributedTypeLoc TL,
   TL.setAttr(State.takeAttrForAttributedType(TL.getTypePtr()));
 }
 
-static void fillHLSLAttributedResourceTypeLoc(HLSLAttributedResourceTypeLoc TL, TypeProcessingState &State) { 
-  TL.setSourceRange(State.getSema().HLSL().TakeLocForHLSLAttribute(TL.getTypePtr()));
+static void fillHLSLAttributedResourceTypeLoc(HLSLAttributedResourceTypeLoc TL,
+                                              TypeProcessingState &State) {
+  TL.setSourceRange(
+      State.getSema().HLSL().TakeLocForHLSLAttribute(TL.getTypePtr()));
 }
 
 static void fillMatrixTypeLoc(MatrixTypeLoc MTL,

``````````

</details>


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


More information about the cfe-commits mailing list