Skip to content

Commit 1228e74

Browse files
committed
IGNORE PRE-REQ COMMIT: it was getting a little complicated to stack this nicely
1 parent 420e2f5 commit 1228e74

File tree

10 files changed

+493
-258
lines changed

10 files changed

+493
-258
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13084,6 +13084,7 @@ def err_hlsl_resource_range_overlap: Error<
1308413084
"resource ranges %sub{subst_hlsl_format_ranges}0,1,2,3 and %sub{subst_hlsl_format_ranges}4,5,6,7 "
1308513085
"overlap within space = %8 and visibility = "
1308613086
"%select{All|Vertex|Hull|Domain|Geometry|Pixel|Amplification|Mesh}9">;
13087+
def note_hlsl_resource_range_here: Note<"overlapping resource range here">;
1308713088

1308813089
// Layout randomization diagnostics.
1308913090
def err_non_designated_init_used : Error<

clang/include/clang/Parse/ParseHLSLRootSignature.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "clang/Basic/DiagnosticParse.h"
1818
#include "clang/Lex/LexHLSLRootSignature.h"
1919
#include "clang/Lex/Preprocessor.h"
20+
#include "clang/Sema/SemaHLSL.h"
2021

2122
#include "llvm/ADT/SmallVector.h"
2223
#include "llvm/ADT/StringRef.h"
@@ -29,7 +30,7 @@ namespace hlsl {
2930
class RootSignatureParser {
3031
public:
3132
RootSignatureParser(llvm::dxbc::RootSignatureVersion Version,
32-
SmallVector<llvm::hlsl::rootsig::RootElement> &Elements,
33+
SmallVector<RootSignatureElement> &Elements,
3334
StringLiteral *Signature, Preprocessor &PP);
3435

3536
/// Consumes tokens from the Lexer and constructs the in-memory
@@ -201,7 +202,7 @@ class RootSignatureParser {
201202

202203
private:
203204
llvm::dxbc::RootSignatureVersion Version;
204-
SmallVector<llvm::hlsl::rootsig::RootElement> &Elements;
205+
SmallVector<RootSignatureElement> &Elements;
205206
StringLiteral *Signature;
206207
RootSignatureLexer Lexer;
207208
Preprocessor &PP;

clang/include/clang/Sema/SemaHLSL.h

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,25 @@ class ParsedAttr;
3232
class Scope;
3333
class VarDecl;
3434

35+
namespace hlsl {
36+
37+
// Introduce a wrapper struct around the underlying RootElement. This structure
38+
// will retain extra clang diagnostic information that is not available in llvm.
39+
struct RootSignatureElement {
40+
RootSignatureElement(SourceLocation Loc,
41+
llvm::hlsl::rootsig::RootElement Element)
42+
: Loc(Loc), Element(Element) {}
43+
44+
const llvm::hlsl::rootsig::RootElement &getElement() const { return Element; }
45+
const SourceLocation &getLocation() const { return Loc; }
46+
47+
private:
48+
SourceLocation Loc;
49+
llvm::hlsl::rootsig::RootElement Element;
50+
};
51+
52+
} // namespace hlsl
53+
3554
using llvm::dxil::ResourceClass;
3655

3756
// FIXME: This can be hidden (as static function in SemaHLSL.cpp) once we no
@@ -130,12 +149,14 @@ class SemaHLSL : public SemaBase {
130149

131150
/// Creates the Root Signature decl of the parsed Root Signature elements
132151
/// onto the AST and push it onto current Scope
133-
void ActOnFinishRootSignatureDecl(
134-
SourceLocation Loc, IdentifierInfo *DeclIdent,
135-
SmallVector<llvm::hlsl::rootsig::RootElement> &Elements);
136-
137-
// Returns true when D is invalid and a diagnostic was produced
138-
bool handleRootSignatureDecl(HLSLRootSignatureDecl *D, SourceLocation Loc);
152+
void
153+
ActOnFinishRootSignatureDecl(SourceLocation Loc, IdentifierInfo *DeclIdent,
154+
ArrayRef<hlsl::RootSignatureElement> Elements);
155+
156+
// Returns true if any RootSignatureElement is invalid and a diagnostic was
157+
// produced
158+
bool
159+
handleRootSignatureElements(ArrayRef<hlsl::RootSignatureElement> Elements);
139160
void handleRootSignatureAttr(Decl *D, const ParsedAttr &AL);
140161
void handleNumThreadsAttr(Decl *D, const ParsedAttr &AL);
141162
void handleWaveSizeAttr(Decl *D, const ParsedAttr &AL);

clang/lib/Parse/ParseDeclCXX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4948,7 +4948,7 @@ void Parser::ParseHLSLRootSignatureAttributeArgs(ParsedAttributes &Attrs) {
49484948
// signature string and construct the in-memory elements
49494949
if (!Found) {
49504950
// Invoke the root signature parser to construct the in-memory constructs
4951-
SmallVector<llvm::hlsl::rootsig::RootElement> RootElements;
4951+
SmallVector<hlsl::RootSignatureElement> RootElements;
49524952
hlsl::RootSignatureParser Parser(getLangOpts().HLSLRootSigVer, RootElements,
49534953
Signature, PP);
49544954
if (Parser.parse()) {

0 commit comments

Comments
 (0)