Skip to content

[HLSL][RootSignature] Fix formatting of puncuator Tokens in LexHLSL #145814

Closed
@inbelic

Description

@inbelic

There is a bug in the diagnostic output of ParseHLSLRootSignature when outputting a punctuator. Instead of outputting the string literal of the token ',' it instead will treat it as an integer and output the ascii value.

Proposed solution:

Update the following switch statement to have a separate macro for PUNCUATOR that will output a string literal of the character as opposed to just the character.

inline const DiagnosticBuilder &
operator<<(const DiagnosticBuilder &DB, const RootSignatureToken::Kind Kind) {
switch (Kind) {
#define TOK(X, SPELLING) \
case RootSignatureToken::Kind::X: \
DB << SPELLING; \
break;
#include "clang/Lex/HLSLRootSignatureTokenKinds.def"
}
return DB;
}

For instance: https://godbolt.org/z/vbY717qMh

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Supportclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions