|
41 | 41 | #include "llvm/ADT/PointerUnion.h" |
42 | 42 | #include "llvm/ADT/StringRef.h" |
43 | 43 | #include "llvm/ADT/iterator_range.h" |
| 44 | +#include "llvm/Frontend/HLSL/HLSLRootSignature.h" |
44 | 45 | #include "llvm/Support/Casting.h" |
45 | 46 | #include "llvm/Support/Compiler.h" |
46 | 47 | #include "llvm/Support/TrailingObjects.h" |
@@ -5178,6 +5179,42 @@ class HLSLBufferDecl final : public NamedDecl, public DeclContext { |
5178 | 5179 | friend class ASTDeclWriter; |
5179 | 5180 | }; |
5180 | 5181 |
|
| 5182 | +class HLSLRootSignatureDecl final |
| 5183 | + : public NamedDecl, |
| 5184 | + private llvm::TrailingObjects<HLSLRootSignatureDecl, |
| 5185 | + llvm::hlsl::rootsig::RootElement> { |
| 5186 | + friend TrailingObjects; |
| 5187 | + |
| 5188 | + unsigned NumElems; |
| 5189 | + |
| 5190 | + llvm::hlsl::rootsig::RootElement *getElems() { |
| 5191 | + return getTrailingObjects<llvm::hlsl::rootsig::RootElement>(); |
| 5192 | + } |
| 5193 | + |
| 5194 | + const llvm::hlsl::rootsig::RootElement *getElems() const { |
| 5195 | + return getTrailingObjects<llvm::hlsl::rootsig::RootElement>(); |
| 5196 | + } |
| 5197 | + |
| 5198 | + HLSLRootSignatureDecl(DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID, |
| 5199 | + unsigned NumElems); |
| 5200 | + |
| 5201 | +public: |
| 5202 | + static HLSLRootSignatureDecl * |
| 5203 | + Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID, |
| 5204 | + ArrayRef<llvm::hlsl::rootsig::RootElement> RootElements); |
| 5205 | + |
| 5206 | + static HLSLRootSignatureDecl *CreateDeserialized(ASTContext &C, |
| 5207 | + GlobalDeclID ID); |
| 5208 | + |
| 5209 | + ArrayRef<llvm::hlsl::rootsig::RootElement> getRootElements() const { |
| 5210 | + return {getElems(), NumElems}; |
| 5211 | + } |
| 5212 | + |
| 5213 | + // Implement isa/cast/dyncast/etc. |
| 5214 | + static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 5215 | + static bool classofKind(Kind K) { return K == HLSLRootSignature; } |
| 5216 | +}; |
| 5217 | + |
5181 | 5218 | /// Insertion operator for diagnostics. This allows sending NamedDecl's |
5182 | 5219 | /// into a diagnostic with <<. |
5183 | 5220 | inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &PD, |
|
0 commit comments