Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions clang/include/clang/Parse/ParseHLSLRootSignature.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ namespace hlsl {
class RootSignatureParser {
public:
RootSignatureParser(llvm::dxbc::RootSignatureVersion Version,
SmallVector<RootSignatureElement> &Elements,
StringLiteral *Signature, Preprocessor &PP);

/// Consumes tokens from the Lexer and constructs the in-memory
Expand All @@ -40,6 +39,9 @@ class RootSignatureParser {
/// Returns true if a parsing error is encountered.
bool parse();

/// Return all elements that have been parsed.
ArrayRef<RootSignatureElement> getElements() { return Elements; }

private:
DiagnosticsEngine &getDiags() { return PP.getDiagnostics(); }

Expand Down Expand Up @@ -226,7 +228,7 @@ class RootSignatureParser {

private:
llvm::dxbc::RootSignatureVersion Version;
SmallVector<RootSignatureElement> &Elements;
SmallVector<RootSignatureElement> Elements;
StringLiteral *Signature;
RootSignatureLexer Lexer;
Preprocessor &PP;
Expand Down
7 changes: 3 additions & 4 deletions clang/lib/Parse/ParseDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4940,17 +4940,16 @@ void Parser::ParseHLSLRootSignatureAttributeArgs(ParsedAttributes &Attrs) {
// signature string and construct the in-memory elements
if (!Found) {
// Invoke the root signature parser to construct the in-memory constructs
SmallVector<hlsl::RootSignatureElement> RootElements;
hlsl::RootSignatureParser Parser(getLangOpts().HLSLRootSigVer, RootElements,
Signature, PP);
hlsl::RootSignatureParser Parser(getLangOpts().HLSLRootSigVer, Signature,
PP);
if (Parser.parse()) {
T.consumeClose();
return;
}

// Construct the declaration.
Actions.HLSL().ActOnFinishRootSignatureDecl(RootSignatureLoc, DeclIdent,
RootElements);
Parser.getElements());
}

// Create the arg for the ParsedAttr
Expand Down
7 changes: 3 additions & 4 deletions clang/lib/Parse/ParseHLSLRootSignature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ static const TokenKind RootElementKeywords[] = {
};

RootSignatureParser::RootSignatureParser(
llvm::dxbc::RootSignatureVersion Version,
SmallVector<RootSignatureElement> &Elements, StringLiteral *Signature,
llvm::dxbc::RootSignatureVersion Version, StringLiteral *Signature,
Preprocessor &PP)
: Version(Version), Elements(Elements), Signature(Signature),
Lexer(Signature->getString()), PP(PP), CurToken(0) {}
: Version(Version), Signature(Signature), Lexer(Signature->getString()),
PP(PP), CurToken(0) {}

bool RootSignatureParser::parse() {
// Iterate as many RootSignatureElements as possible, until we hit the
Expand Down
Loading