Skip to content

[HLSL] Remove hlsl::Resource #98938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2024
Merged

Conversation

bogner
Copy link
Contributor

@bogner bogner commented Jul 15, 2024

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

This was added in an effort to support resource types before we
created the HLSLResource builtin type, but it isn't needed.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support labels Jul 15, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 15, 2024

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-hlsl

Author: Justin Bogner (bogner)

Changes

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 --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;

Copy link
Collaborator

@llvm-beanz llvm-beanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, this can go. I think I had intended to use this as the underlying type for the resource descriptor heap for dynamic resources. We can figure out a better approach for that when we get there.

@bogner bogner merged commit d269071 into llvm:main Jul 16, 2024
11 checks passed
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
This was added in an effort to support resource types before we created
the HLSLResource builtin type, but it isn't needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category HLSL HLSL Language Support
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants