@@ -39,18 +39,19 @@ class ParseHLSLRootSignatureTest : public ::testing::Test {
39
39
Target = TargetInfo::CreateTargetInfo (Diags, TargetOpts);
40
40
}
41
41
42
- Preprocessor *CreatePP (StringRef Source, TrivialModuleLoader &ModLoader) {
42
+ std::unique_ptr<Preprocessor> CreatePP (StringRef Source,
43
+ TrivialModuleLoader &ModLoader) {
43
44
std::unique_ptr<llvm::MemoryBuffer> Buf =
44
45
llvm::MemoryBuffer::getMemBuffer (Source);
45
46
SourceMgr.setMainFileID (SourceMgr.createFileID (std::move (Buf)));
46
47
47
48
HeaderSearch HeaderInfo (std::make_shared<HeaderSearchOptions>(), SourceMgr,
48
49
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 );
54
55
PP->Initialize (*Target);
55
56
PP->EnterMainSourceFile ();
56
57
return PP;
@@ -107,7 +108,7 @@ TEST_F(ParseHLSLRootSignatureTest, LexValidTokensTest) {
107
108
)cc" ;
108
109
109
110
TrivialModuleLoader ModLoader;
110
- Preprocessor * PP = CreatePP (Source, ModLoader);
111
+ auto PP = CreatePP (Source, ModLoader);
111
112
auto TokLoc = SourceLocation ();
112
113
113
114
RootSignatureLexer Lexer (Source, TokLoc, *PP);
@@ -123,8 +124,6 @@ TEST_F(ParseHLSLRootSignatureTest, LexValidTokensTest) {
123
124
};
124
125
125
126
CheckTokens (Tokens, Expected);
126
-
127
- delete PP;
128
127
}
129
128
130
129
} // anonymous namespace
0 commit comments