Skip to content

Commit 135e6c9

Browse files
committed
pre-req: update attr to store reference to root signature decl
1 parent e74877b commit 135e6c9

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4739,7 +4739,8 @@ def Error : InheritableAttr {
47394739
def RootSignature : Attr {
47404740
/// [RootSignature(Signature)]
47414741
let Spellings = [Microsoft<"RootSignature">];
4742-
let Args = [IdentifierArgument<"Signature">];
4742+
let Args = [IdentifierArgument<"SignatureIdent">,
4743+
DeclArgument<HLSLRootSignature, "SignatureDecl", 0, /*fake=*/1>];
47434744
let Subjects = SubjectList<[Function],
47444745
ErrorDiag, "'function'">;
47454746
let LangOpts = [HLSL];

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ void SemaHLSL::handleRootSignatureAttr(Decl *D, const ParsedAttr &AL) {
959959

960960
IdentifierInfo *Ident = AL.getArgAsIdent(0)->getIdentifierInfo();
961961
if (auto *RS = D->getAttr<RootSignatureAttr>()) {
962-
if (RS->getSignature() != Ident) {
962+
if (RS->getSignatureIdent() != Ident) {
963963
Diag(AL.getLoc(), diag::err_disallowed_duplicate_attribute) << RS;
964964
return;
965965
}
@@ -970,10 +970,11 @@ void SemaHLSL::handleRootSignatureAttr(Decl *D, const ParsedAttr &AL) {
970970

971971
LookupResult R(SemaRef, Ident, SourceLocation(), Sema::LookupOrdinaryName);
972972
if (SemaRef.LookupQualifiedName(R, D->getDeclContext()))
973-
if (isa<HLSLRootSignatureDecl>(R.getFoundDecl())) {
973+
if (auto *SignatureDecl =
974+
dyn_cast<HLSLRootSignatureDecl>(R.getFoundDecl())) {
974975
// Perform validation of constructs here
975-
D->addAttr(::new (getASTContext())
976-
RootSignatureAttr(getASTContext(), AL, Ident));
976+
D->addAttr(::new (getASTContext()) RootSignatureAttr(
977+
getASTContext(), AL, Ident, SignatureDecl));
977978
}
978979
}
979980

0 commit comments

Comments
 (0)