Skip to content

Commit 403dbf8

Browse files
committed
self-review: remove ast allocation
1 parent 45b2d92 commit 403dbf8

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

clang/lib/Parse/ParseDeclCXX.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5369,20 +5369,13 @@ void Parser::ParseMicrosoftRootSignatureAttributeArgs(ParsedAttributes &Attrs) {
53695369
1); // offset 1 for '"'
53705370
// Invoke the root signature parser to construct the in-memory constructs
53715371
hlsl::RootSignatureLexer Lexer(Signature, SignatureLoc);
5372-
SmallVector<llvm::hlsl::rootsig::RootElement> Elements;
5373-
hlsl::RootSignatureParser Parser(Elements, Lexer, PP);
5372+
SmallVector<llvm::hlsl::rootsig::RootElement> RootElements;
5373+
hlsl::RootSignatureParser Parser(RootElements, Lexer, PP);
53745374
if (Parser.parse()) {
53755375
T.consumeClose();
53765376
return;
53775377
}
53785378

5379-
// Allocate the root elements onto ASTContext
5380-
unsigned N = Elements.size();
5381-
auto RootElements = MutableArrayRef<llvm::hlsl::rootsig::RootElement>(
5382-
::new (Actions.getASTContext()) llvm::hlsl::rootsig::RootElement[N], N);
5383-
for (unsigned I = 0; I < N; ++I)
5384-
RootElements[I] = Elements[I];
5385-
53865379
// Create the Root Signature
53875380
auto *SignatureDecl = HLSLRootSignatureDecl::Create(
53885381
Actions.getASTContext(), /*DeclContext=*/Actions.CurContext,

0 commit comments

Comments
 (0)