Author: Finn Plummer Date: 2025-06-26T09:19:10-07:00 New Revision: 2e3995981cb3373e1159c2822e9ab48911caa0d9
URL: https://github.com/llvm/llvm-project/commit/2e3995981cb3373e1159c2822e9ab48911caa0d9 DIFF: https://github.com/llvm/llvm-project/commit/2e3995981cb3373e1159c2822e9ab48911caa0d9.diff LOG: [HLSL][RootSignature] Use "stringified" version for diagnostic output of punctuator tokens (#145827) This pr will corrects the output with a stringified version of a puncuator (eg `')'`) instead of its ascii value. - Update `LexHLSLRootSignature` to fix the `DiagnosticBuilder` `operator<<` overload to correclty format the puncuator - Add testcase demonstrating the stringified version is output Resolves https://github.com/llvm/llvm-project/issues/145814. Added: Modified: clang/include/clang/Lex/LexHLSLRootSignature.h clang/test/SemaHLSL/RootSignature-err.hlsl Removed: ################################################################################ diff --git a/clang/include/clang/Lex/LexHLSLRootSignature.h b/clang/include/clang/Lex/LexHLSLRootSignature.h index 9275e0d75840b..9901485b44d38 100644 --- a/clang/include/clang/Lex/LexHLSLRootSignature.h +++ b/clang/include/clang/Lex/LexHLSLRootSignature.h @@ -50,6 +50,10 @@ operator<<(const DiagnosticBuilder &DB, const RootSignatureToken::Kind Kind) { case RootSignatureToken::Kind::X: \ DB << SPELLING; \ break; +#define PUNCTUATOR(X, SPELLING) \ + case RootSignatureToken::Kind::pu_##X: \ + DB << #SPELLING; \ + break; #include "clang/Lex/HLSLRootSignatureTokenKinds.def" } return DB; diff --git a/clang/test/SemaHLSL/RootSignature-err.hlsl b/clang/test/SemaHLSL/RootSignature-err.hlsl index f544247f4db2a..aec8a15f8ed7f 100644 --- a/clang/test/SemaHLSL/RootSignature-err.hlsl +++ b/clang/test/SemaHLSL/RootSignature-err.hlsl @@ -18,3 +18,7 @@ void bad_root_signature_3() {} [RootSignature("DescriptorTable(), invalid")] // expected-error {{expected end of stream to denote end of parameters, or, another valid parameter of RootSignature}} void bad_root_signature_4() {} + +// expected-error@+1 {{expected ')' to denote end of parameters, or, another valid parameter of RootConstants}} +[RootSignature("RootConstants(b0, num32BitConstants = 1, invalid)")] +void bad_root_signature_5() {} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits