[clang] [HLSL] Remove hlsl::Resource (PR #98938)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 15 10:37:39 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang

@llvm/pr-subscribers-hlsl

Author: Justin Bogner (bogner)

<details>
<summary>Changes</summary>

This was added in an effort to support resource types before we created the HLSLResource builtin type, but it isn't needed.

---
Full diff: https://github.com/llvm/llvm-project/pull/98938.diff


5 Files Affected:

- (modified) clang/include/clang/Sema/HLSLExternalSemaSource.h (-1) 
- (modified) clang/lib/Sema/HLSLExternalSemaSource.cpp (-6) 
- (modified) clang/test/AST/HLSL/RWBuffer-AST.hlsl (+2-6) 
- (removed) clang/test/AST/HLSL/ResourceStruct.hlsl (-14) 
- (modified) clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl (-1) 


``````````diff
diff --git a/clang/include/clang/Sema/HLSLExternalSemaSource.h b/clang/include/clang/Sema/HLSLExternalSemaSource.h
index c0bfff327139f..3c7495e66055d 100644
--- a/clang/include/clang/Sema/HLSLExternalSemaSource.h
+++ b/clang/include/clang/Sema/HLSLExternalSemaSource.h
@@ -23,7 +23,6 @@ class Sema;
 class HLSLExternalSemaSource : public ExternalSemaSource {
   Sema *SemaPtr = nullptr;
   NamespaceDecl *HLSLNamespace = nullptr;
-  CXXRecordDecl *ResourceDecl = nullptr;
 
   using CompletionFunction = std::function<void(CXXRecordDecl *)>;
   llvm::DenseMap<CXXRecordDecl *, CompletionFunction> Completions;
diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp
index 7fcf5754f9dd7..ca88d138aef5d 100644
--- a/clang/lib/Sema/HLSLExternalSemaSource.cpp
+++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp
@@ -482,12 +482,6 @@ void HLSLExternalSemaSource::defineHLSLVectorAlias() {
 
 void HLSLExternalSemaSource::defineTrivialHLSLTypes() {
   defineHLSLVectorAlias();
-
-  ResourceDecl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace, "Resource")
-                     .startDefinition()
-                     .addHandleMember(AccessSpecifier::AS_public)
-                     .completeDefinition()
-                     .Record;
 }
 
 /// Set up common members and attributes for buffer types
diff --git a/clang/test/AST/HLSL/RWBuffer-AST.hlsl b/clang/test/AST/HLSL/RWBuffer-AST.hlsl
index cb66a703a4ec9..e95acb8896ba4 100644
--- a/clang/test/AST/HLSL/RWBuffer-AST.hlsl
+++ b/clang/test/AST/HLSL/RWBuffer-AST.hlsl
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY %s | FileCheck -check-prefix=EMPTY %s 
-// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump %s | FileCheck %s 
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY %s | FileCheck -check-prefix=EMPTY %s
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump %s | FileCheck %s
 
 
 // This test tests two different AST generations. The "EMPTY" test mode verifies
@@ -25,10 +25,6 @@ RWBuffer<float> Buffer;
 
 #endif
 
-// CHECK: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit <undeserialized declarations> class Resource definition
-// CHECK: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final
-// CHECK-NEXT: FieldDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit h 'void *'
-
 // CHECK: ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit RWBuffer
 // CHECK-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> class depth 0 index 0 element_type
 // CHECK-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit class RWBuffer definition
diff --git a/clang/test/AST/HLSL/ResourceStruct.hlsl b/clang/test/AST/HLSL/ResourceStruct.hlsl
deleted file mode 100644
index 04b3b93119903..0000000000000
--- a/clang/test/AST/HLSL/ResourceStruct.hlsl
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -ast-dump %s | FileCheck %s 
-
-// CHECK: NamespaceDecl {{.*}} implicit hlsl
-// CHECK: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit <undeserialized declarations> class Resource definition
-// CHECK-NEXT: DefinitionData
-// CHECK-NEXT: DefaultConstructor exists trivial needs_implicit
-// CHECK-NEXT: CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: MoveConstructor exists simple trivial needs_implicit
-// CHECK-NEXT: CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: MoveAssignment exists simple trivial needs_implicit
-// CHECK-NEXT: Destructor simple irrelevant trivial needs_implicit
-// CHECK-NEXT: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final
-// CHECK-NEXT: FieldDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc>
-// implicit h 'void *'
diff --git a/clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl b/clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl
index fecf3b76ff7bb..774309c714f65 100644
--- a/clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl
+++ b/clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl
@@ -1,6 +1,5 @@
 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -fsyntax-only -verify %s
 
-Resource ResourceDescriptorHeap[5];
 typedef vector<float, 3> float3;
 
 RWBuffer<float3> Buffer;

``````````

</details>


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


More information about the cfe-commits mailing list