Skip to content

Commit bc9bb26

Browse files
committed
define ActOnFinishRootSignatureDecl
1 parent f8b165e commit bc9bb26

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3621,6 +3621,9 @@ class Sema final : public SemaBase {
36213621

36223622
std::pair<IdentifierInfo *, bool>
36233623
ActOnStartRootSignatureDecl(StringRef Signature);
3624+
void ActOnFinishRootSignatureDecl(
3625+
SourceLocation Loc, IdentifierInfo *DeclIdent,
3626+
SmallVector<llvm::hlsl::rootsig::RootElement> &Elements);
36243627

36253628
class NameClassification {
36263629
NameClassificationKind Kind;

clang/lib/Parse/ParseDeclCXX.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4958,12 +4958,8 @@ void Parser::ParseMicrosoftRootSignatureAttributeArgs(ParsedAttributes &Attrs) {
49584958
return;
49594959
}
49604960

4961-
// Create the Root Signature
4962-
auto *SignatureDecl = HLSLRootSignatureDecl::Create(
4963-
Actions.getASTContext(), /*DeclContext=*/Actions.CurContext,
4964-
RootSignatureLoc, DeclIdent, RootElements);
4965-
SignatureDecl->setImplicit();
4966-
Actions.PushOnScopeChains(SignatureDecl, getCurScope());
4961+
Actions.ActOnFinishRootSignatureDecl(RootSignatureLoc, DeclIdent,
4962+
RootElements);
49674963
}
49684964

49694965
// Create the arg for the ParsedAttr

clang/lib/Sema/SemaDecl.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#include "llvm/ADT/SmallPtrSet.h"
6363
#include "llvm/ADT/SmallString.h"
6464
#include "llvm/ADT/StringExtras.h"
65+
#include "llvm/Frontend/HLSL/HLSLRootSignature.h"
6566
#include "llvm/Support/SaveAndRestore.h"
6667
#include "llvm/TargetParser/Triple.h"
6768
#include <algorithm>
@@ -660,12 +661,22 @@ Sema::ActOnStartRootSignatureDecl(StringRef Signature) {
660661
IdentifierInfo *DeclIdent = &(getASTContext().Idents.get(IdStr));
661662

662663
// Check if we have already found a decl of the same name
663-
LookupResult R(Actions, DeclIdent, SourceLocation(),
664-
Sema::LookupOrdinaryName);
665-
bool Found = LookupQualifiedName(R, Actions.CurContext);
664+
LookupResult R(*this, DeclIdent, SourceLocation(), Sema::LookupOrdinaryName);
665+
bool Found = LookupQualifiedName(R, this->CurContext);
666666
return {DeclIdent, Found};
667667
}
668668

669+
void Sema::ActOnFinishRootSignatureDecl(
670+
SourceLocation Loc, IdentifierInfo *DeclIdent,
671+
SmallVector<llvm::hlsl::rootsig::RootElement> &Elements) {
672+
// Create the Root Signature
673+
auto *SignatureDecl = HLSLRootSignatureDecl::Create(
674+
getASTContext(), /*DeclContext=*/CurContext, Loc, DeclIdent, Elements);
675+
676+
SignatureDecl->setImplicit();
677+
PushOnScopeChains(SignatureDecl, getCurScope());
678+
}
679+
669680
DeclSpec::TST Sema::isTagName(IdentifierInfo &II, Scope *S) {
670681
// Do a tag name lookup in this scope.
671682
LookupResult R(*this, &II, SourceLocation(), LookupTagName);

0 commit comments

Comments
 (0)