Skip to content

Commit a328619

Browse files
committed
review comments:
- fix typo - use std::unique_ptr for testing mem management
1 parent 949b50a commit a328619

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

clang/lib/Parse/ParseHLSLRootSignature.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ bool RootSignatureLexer::LexNumber(RootSignatureToken &Result) {
2020
// Retrieve the possible number
2121
StringRef NumSpelling = Buffer.take_while(IsPreprocessorNumberChar);
2222

23-
// Parse the numeric value and so semantic checks on its specification
23+
// Parse the numeric value and do semantic checks on its specification
2424
clang::NumericLiteralParser Literal(NumSpelling, SourceLoc,
2525
PP.getSourceManager(), PP.getLangOpts(),
2626
PP.getTargetInfo(), PP.getDiagnostics());

clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,19 @@ class ParseHLSLRootSignatureTest : public ::testing::Test {
3939
Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
4040
}
4141

42-
Preprocessor *CreatePP(StringRef Source, TrivialModuleLoader &ModLoader) {
42+
std::unique_ptr<Preprocessor> CreatePP(StringRef Source,
43+
TrivialModuleLoader &ModLoader) {
4344
std::unique_ptr<llvm::MemoryBuffer> Buf =
4445
llvm::MemoryBuffer::getMemBuffer(Source);
4546
SourceMgr.setMainFileID(SourceMgr.createFileID(std::move(Buf)));
4647

4748
HeaderSearch HeaderInfo(std::make_shared<HeaderSearchOptions>(), SourceMgr,
4849
Diags, LangOpts, Target.get());
49-
Preprocessor *PP =
50-
new Preprocessor(std::make_shared<PreprocessorOptions>(), Diags,
51-
LangOpts, SourceMgr, HeaderInfo, ModLoader,
52-
/*IILookup =*/nullptr,
53-
/*OwnsHeaderSearch =*/false);
50+
std::unique_ptr<Preprocessor> PP = std::make_unique<Preprocessor>(
51+
std::make_shared<PreprocessorOptions>(), Diags, LangOpts, SourceMgr,
52+
HeaderInfo, ModLoader,
53+
/*IILookup =*/nullptr,
54+
/*OwnsHeaderSearch =*/false);
5455
PP->Initialize(*Target);
5556
PP->EnterMainSourceFile();
5657
return PP;
@@ -107,7 +108,7 @@ TEST_F(ParseHLSLRootSignatureTest, LexValidTokensTest) {
107108
)cc";
108109

109110
TrivialModuleLoader ModLoader;
110-
Preprocessor *PP = CreatePP(Source, ModLoader);
111+
auto PP = CreatePP(Source, ModLoader);
111112
auto TokLoc = SourceLocation();
112113

113114
RootSignatureLexer Lexer(Source, TokLoc, *PP);
@@ -123,8 +124,6 @@ TEST_F(ParseHLSLRootSignatureTest, LexValidTokensTest) {
123124
};
124125

125126
CheckTokens(Tokens, Expected);
126-
127-
delete PP;
128127
}
129128

130129
} // anonymous namespace

0 commit comments

Comments
 (0)