Skip to content

Commit 1abd7ac

Browse files
committed
review: add wrong number of arguments diagnostic
1 parent bde15d0 commit 1abd7ac

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,10 @@ void SemaHLSL::emitLogicalOperatorFixIt(Expr *LHS, Expr *RHS,
649649
}
650650

651651
void SemaHLSL::handleRootSignatureAttr(Decl *D, const ParsedAttr &AL) {
652-
if (AL.getNumArgs() != 1)
652+
if (AL.getNumArgs() != 1) {
653+
Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) << AL << 1;
653654
return;
655+
}
654656

655657
StringRef Signature;
656658
if (!SemaRef.checkStringLiteralArgumentAttr(AL, 0, Signature))

clang/test/SemaHLSL/RootSignature-err.hlsl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
// This file mirrors the diagnostics testing in ParseHLSLRootSignatureTest.cpp
44
// to verify that the correct diagnostics strings are output
55

6+
// Attr test
7+
8+
[RootSignature()] // expected-error {{'RootSignature' attribute takes one argument}}
9+
void bad_root_signature_0() {}
10+
611
// Lexer related tests
712

813
#define InvalidToken \

0 commit comments

Comments
 (0)