[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-12 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 closed https://github.com/llvm/llvm-project/pull/98419 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-12 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/98419 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-12 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. https://github.com/llvm/llvm-project/pull/98419 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-12 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/98419 >From b740aa9da3baf4fbd32b5a2c59d70bf2f224f700 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 10 Jul 2024 17:10:26 -0700 Subject: [PATCH 1/8] split out resource class data from resource attr, add some

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -o - %s -verify + +// expected-error@+1{{'resource_class' attribute takes one argument}} +struct [[hlsl::resource_class()]] Eg1 { + int i; +}; + +Eg1 e1; + +// expected-error@+1{{invalid resource class

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Joshua Batista via cfe-commits
@@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -o - %s -verify + +// expected-error@+1{{'resource_class' attribute takes one argument}} +struct [[hlsl::resource_class()]] Eg1 { + int i; +}; + +Eg1 e1; + +// expected-error@+1{{invalid resource class

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -o - %s -verify + +// expected-error@+1{{'resource_class' attribute takes one argument}} +struct [[hlsl::resource_class()]] Eg1 { + int i; +}; + +Eg1 e1; + +// expected-error@+1{{invalid resource class

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Joshua Batista via cfe-commits
@@ -437,6 +437,33 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +void SemaHLSL::handleResourceClassAttr(Decl *D, const ParsedAttr &AL) { + if (!AL.isArgIdent(0)) { +Diag(AL.getLoc(), diag::err_attribute_argument_type) +

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Justin Bogner via cfe-commits
@@ -115,12 +115,19 @@ struct BuiltinTypeDeclBuilder { return addMemberVariable("h", Ty, Access); } - BuiltinTypeDeclBuilder &annotateResourceClass(ResourceClass RC, -ResourceKind RK, bool IsROV) { + BuiltinTypeDeclBuilder

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Justin Bogner via cfe-commits
@@ -437,6 +437,33 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +void SemaHLSL::handleResourceClassAttr(Decl *D, const ParsedAttr &AL) { + if (!AL.isArgIdent(0)) { +Diag(AL.getLoc(), diag::err_attribute_argument_type) +

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Justin Bogner via cfe-commits
@@ -437,6 +437,33 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +void SemaHLSL::handleResourceClassAttr(Decl *D, const ParsedAttr &AL) { + if (!AL.isArgIdent(0)) { +Diag(AL.getLoc(), diag::err_attribute_argument_type) +

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s + + +// CHECK: -HLSLResourceClassAttr 0x{{[0-9a-f]+}} <> SRV +struct [[hlsl::resource_class(SRV)]] Eg1 { bogner wrote: Ah, I hadn't noticed the "

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Joshua Batista via cfe-commits
@@ -7,7 +7,7 @@ struct [[hlsl::resource_class()]] Eg1 { Eg1 e1; -// expected-error@+1{{invalid resource class 'gibberish' used; expected 'SRV', 'UAV', 'CBuffer', or 'Sampler'}} +// expected-warning@+1{{ResourceClass attribute argument not supported: gibberish}}

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/98419 >From b740aa9da3baf4fbd32b5a2c59d70bf2f224f700 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 10 Jul 2024 17:10:26 -0700 Subject: [PATCH 1/6] split out resource class data from resource attr, add some

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -o - %s -verify + +// expected-error@+1{{'resource_class' attribute takes one argument}} +struct [[hlsl::resource_class()]] Eg1 { + int i; +}; + +Eg1 e1; + +// expected-error@+1{{invalid resource class

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Damyan Pepper via cfe-commits
@@ -12313,6 +12313,7 @@ def err_hlsl_missing_semantic_annotation : Error< def err_hlsl_init_priority_unsupported : Error< "initializer priorities are not supported in HLSL">; +def err_hlsl_unsupported_resource_class : Error<"invalid resource class '%0' used; expected 'SRV',

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/98419 >From b740aa9da3baf4fbd32b5a2c59d70bf2f224f700 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 10 Jul 2024 17:10:26 -0700 Subject: [PATCH 1/5] split out resource class data from resource attr, add some

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Joshua Batista via cfe-commits
@@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s + + +// CHECK: -HLSLResourceClassAttr 0x{{[0-9a-f]+}} <> SRV +struct [[hlsl::resource_class(SRV)]] Eg1 { + int i; +}; + +Eg1 e1; + +// CHECK: -CXXRecordDecl 0x{

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/98419 >From b740aa9da3baf4fbd32b5a2c59d70bf2f224f700 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 10 Jul 2024 17:10:26 -0700 Subject: [PATCH 1/4] split out resource class data from resource attr, add some

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 edited https://github.com/llvm/llvm-project/pull/98419 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s + + +// CHECK: -HLSLResourceClassAttr 0x{{[0-9a-f]+}} <> SRV +struct [[hlsl::resource_class(SRV)]] Eg1 { bogner wrote: For the purpose of these t

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Justin Bogner via cfe-commits
@@ -437,6 +437,49 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +llvm::dxil::ResourceClass +getResourceClassFromStr(StringRef ResourceClassTypeStrRef) { + if (ResourceClassTypeStrRef == "SRV") +return llvm::dxil::ResourceC

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -o - %s -verify + +// expected-error@+1{{'resource_class' attribute takes one argument}} +struct [[hlsl::resource_class()]] Eg1 { + int i; +}; + +Eg1 e1; + +// expected-error@+1{{invalid resource class

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s + + +// CHECK: -HLSLResourceClassAttr 0x{{[0-9a-f]+}} <> SRV +struct [[hlsl::resource_class(SRV)]] Eg1 { + int i; +}; + +Eg1 e1; + +// CHECK: -CXXRecordDecl 0x{

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Justin Bogner via cfe-commits
@@ -437,6 +437,49 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +llvm::dxil::ResourceClass +getResourceClassFromStr(StringRef ResourceClassTypeStrRef) { + if (ResourceClassTypeStrRef == "SRV") +return llvm::dxil::ResourceC

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Damyan Pepper via cfe-commits
@@ -437,6 +437,49 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +llvm::dxil::ResourceClass +getResourceClassFromStr(StringRef ResourceClassTypeStrRef) { + if (ResourceClassTypeStrRef == "SRV") +return llvm::dxil::ResourceC

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Damyan Pepper via cfe-commits
@@ -280,13 +280,15 @@ void CGHLSLRuntime::annotateHLSLResource(const VarDecl *D, GlobalVariable *GV) { const auto *RD = Ty->getAsCXXRecordDecl(); if (!RD) return; - const auto *Attr = RD->getAttr(); - if (!Attr) + const auto *HLSLResAttr = RD->getAttr(); + const au

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s + + +// CHECK: -HLSLResourceClassAttr 0x{{[0-9a-f]+}} <> SRV +struct [[hlsl::resource_class(SRV)]] Eg1 { damyanp wrote: I thought that the idea w

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/98419 >From b740aa9da3baf4fbd32b5a2c59d70bf2f224f700 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 10 Jul 2024 17:10:26 -0700 Subject: [PATCH 1/3] split out resource class data from resource attr, add some

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/98419 >From b740aa9da3baf4fbd32b5a2c59d70bf2f224f700 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 10 Jul 2024 17:10:26 -0700 Subject: [PATCH 1/2] split out resource class data from resource attr, add some

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 edited https://github.com/llvm/llvm-project/pull/98419 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-hlsl Author: Joshua Batista (bob80905) Changes The ability to spell out and specify the resource class is necessary for testing various resource behaviors. Though it is not intended for users to use this in customized HLSL source code, the ability to s

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 created https://github.com/llvm/llvm-project/pull/98419 The ability to spell out and specify the resource class is necessary for testing various resource behaviors. Though it is not intended for users to use this in customized HLSL source code, the ability to specif