Skip to content

Commit 1688c30

Browse files
authored
[clang] Do not share ownership of PreprocessorOptions (#133467)
This PR makes it so that `CompilerInvocation` is the sole owner of the `PreprocessorOptions` instance.
1 parent 90cf2e3 commit 1688c30

17 files changed

+94
-108
lines changed

clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp

+7-8
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,14 @@ ExpandModularHeadersPPCallbacks::ExpandModularHeadersPPCallbacks(
8989
HeaderInfo = std::make_unique<HeaderSearch>(HSOpts, Sources, Diags, LangOpts,
9090
&Compiler.getTarget());
9191

92-
auto PO = std::make_shared<PreprocessorOptions>();
93-
*PO = Compiler.getPreprocessorOpts();
94-
95-
PP = std::make_unique<clang::Preprocessor>(PO, Diags, LangOpts, Sources,
96-
*HeaderInfo, ModuleLoader,
97-
/*IILookup=*/nullptr,
98-
/*OwnsHeaderSearch=*/false);
92+
PP = std::make_unique<clang::Preprocessor>(Compiler.getPreprocessorOpts(),
93+
Diags, LangOpts, Sources,
94+
*HeaderInfo, ModuleLoader,
95+
/*IILookup=*/nullptr,
96+
/*OwnsHeaderSearch=*/false);
9997
PP->Initialize(Compiler.getTarget(), Compiler.getAuxTarget());
100-
InitializePreprocessor(*PP, *PO, Compiler.getPCHContainerReader(),
98+
InitializePreprocessor(*PP, Compiler.getPreprocessorOpts(),
99+
Compiler.getPCHContainerReader(),
101100
Compiler.getFrontendOpts(), Compiler.getCodeGenOpts());
102101
ApplyHeaderSearchOptions(*HeaderInfo, HSOpts, LangOpts,
103102
Compiler.getTarget().getTriple());

clang-tools-extra/clangd/ModulesBuilder.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,10 @@ bool IsModuleFileUpToDate(PathRef ModuleFilePath,
202202
HeaderSearch HeaderInfo(HSOpts, SourceMgr, *Diags, LangOpts,
203203
/*Target=*/nullptr);
204204

205+
PreprocessorOptions PPOpts;
205206
TrivialModuleLoader ModuleLoader;
206-
Preprocessor PP(std::make_shared<PreprocessorOptions>(), *Diags, LangOpts,
207-
SourceMgr, HeaderInfo, ModuleLoader);
207+
Preprocessor PP(PPOpts, *Diags, LangOpts, SourceMgr, HeaderInfo,
208+
ModuleLoader);
208209

209210
IntrusiveRefCntPtr<ModuleCache> ModCache = createCrossProcessModuleCache();
210211
PCHContainerOperations PCHOperations;

clang/include/clang/Frontend/CompilerInvocation.h

-3
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,6 @@ class CompilerInvocation : public CompilerInvocationBase {
272272
std::shared_ptr<HeaderSearchOptions> getHeaderSearchOptsPtr() {
273273
return HSOpts;
274274
}
275-
std::shared_ptr<PreprocessorOptions> getPreprocessorOptsPtr() {
276-
return PPOpts;
277-
}
278275
std::shared_ptr<LangOptions> getLangOptsPtr() { return LangOpts; }
279276
/// @}
280277

clang/include/clang/Lex/Preprocessor.h

+6-8
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class Preprocessor {
140140
friend class VariadicMacroScopeGuard;
141141

142142
llvm::unique_function<void(const clang::Token &)> OnToken;
143-
std::shared_ptr<const PreprocessorOptions> PPOpts;
143+
const PreprocessorOptions &PPOpts;
144144
DiagnosticsEngine *Diags;
145145
const LangOptions &LangOpts;
146146
const TargetInfo *Target = nullptr;
@@ -1165,10 +1165,9 @@ class Preprocessor {
11651165
void updateOutOfDateIdentifier(const IdentifierInfo &II) const;
11661166

11671167
public:
1168-
Preprocessor(std::shared_ptr<const PreprocessorOptions> PPOpts,
1169-
DiagnosticsEngine &diags, const LangOptions &LangOpts,
1170-
SourceManager &SM, HeaderSearch &Headers,
1171-
ModuleLoader &TheModuleLoader,
1168+
Preprocessor(const PreprocessorOptions &PPOpts, DiagnosticsEngine &diags,
1169+
const LangOptions &LangOpts, SourceManager &SM,
1170+
HeaderSearch &Headers, ModuleLoader &TheModuleLoader,
11721171
IdentifierInfoLookup *IILookup = nullptr,
11731172
bool OwnsHeaderSearch = false,
11741173
TranslationUnitKind TUKind = TU_Complete);
@@ -1195,9 +1194,8 @@ class Preprocessor {
11951194
/// Cleanup after model file parsing
11961195
void FinalizeForModelFile();
11971196

1198-
/// Retrieve the preprocessor options used to initialize this
1199-
/// preprocessor.
1200-
const PreprocessorOptions &getPreprocessorOpts() const { return *PPOpts; }
1197+
/// Retrieve the preprocessor options used to initialize this preprocessor.
1198+
const PreprocessorOptions &getPreprocessorOpts() const { return PPOpts; }
12011199

12021200
DiagnosticsEngine &getDiagnostics() const { return *Diags; }
12031201
void setDiagnostics(DiagnosticsEngine &D) { Diags = &D; }

clang/lib/Frontend/ASTUnit.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile(
844844
HeaderSearch &HeaderInfo = *AST->HeaderInfo;
845845

846846
AST->PP = std::make_shared<Preprocessor>(
847-
AST->PPOpts, AST->getDiagnostics(), *AST->LangOpts,
847+
*AST->PPOpts, AST->getDiagnostics(), *AST->LangOpts,
848848
AST->getSourceManager(), HeaderInfo, AST->ModuleLoader,
849849
/*IILookup=*/nullptr,
850850
/*OwnsHeaderSearch=*/false);

clang/lib/Frontend/CompilerInstance.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ void CompilerInstance::createPreprocessor(TranslationUnitKind TUKind) {
452452
HeaderSearch *HeaderInfo =
453453
new HeaderSearch(getHeaderSearchOpts(), getSourceManager(),
454454
getDiagnostics(), getLangOpts(), &getTarget());
455-
PP = std::make_shared<Preprocessor>(Invocation->getPreprocessorOptsPtr(),
455+
PP = std::make_shared<Preprocessor>(Invocation->getPreprocessorOpts(),
456456
getDiagnostics(), getLangOpts(),
457457
getSourceManager(), *HeaderInfo, *this,
458458
/*IdentifierInfoLookup=*/nullptr,

clang/lib/Lex/PPDirectives.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ Preprocessor::LookupEmbedFile(StringRef Filename, bool isAngled, bool OpenFile,
11541154
}
11551155
}
11561156

1157-
for (const auto &Entry : PPOpts->EmbedEntries) {
1157+
for (const auto &Entry : PPOpts.EmbedEntries) {
11581158
LookupPath.clear();
11591159
SeparateComponents(LookupPath, Entry, Filename, false);
11601160
llvm::Expected<FileEntryRef> ShouldBeEntry = FM.getFileRef(
@@ -2341,7 +2341,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport(
23412341

23422342
enum { Enter, Import, Skip, IncludeLimitReached } Action = Enter;
23432343

2344-
if (PPOpts->SingleFileParseMode)
2344+
if (PPOpts.SingleFileParseMode)
23452345
Action = IncludeLimitReached;
23462346

23472347
// If we've reached the max allowed include depth, it is usually due to an
@@ -3420,11 +3420,11 @@ void Preprocessor::HandleIfdefDirective(Token &Result,
34203420
Callbacks->Ifdef(DirectiveTok.getLocation(), MacroNameTok, MD);
34213421
}
34223422

3423-
bool RetainExcludedCB = PPOpts->RetainExcludedConditionalBlocks &&
3423+
bool RetainExcludedCB = PPOpts.RetainExcludedConditionalBlocks &&
34243424
getSourceManager().isInMainFile(DirectiveTok.getLocation());
34253425

34263426
// Should we include the stuff contained by this directive?
3427-
if (PPOpts->SingleFileParseMode && !MI) {
3427+
if (PPOpts.SingleFileParseMode && !MI) {
34283428
// In 'single-file-parse mode' undefined identifiers trigger parsing of all
34293429
// the directive blocks.
34303430
CurPPLexer->pushConditionalLevel(DirectiveTok.getLocation(),
@@ -3475,11 +3475,11 @@ void Preprocessor::HandleIfDirective(Token &IfToken,
34753475
IfToken.getLocation(), DER.ExprRange,
34763476
(ConditionalTrue ? PPCallbacks::CVK_True : PPCallbacks::CVK_False));
34773477

3478-
bool RetainExcludedCB = PPOpts->RetainExcludedConditionalBlocks &&
3478+
bool RetainExcludedCB = PPOpts.RetainExcludedConditionalBlocks &&
34793479
getSourceManager().isInMainFile(IfToken.getLocation());
34803480

34813481
// Should we include the stuff contained by this directive?
3482-
if (PPOpts->SingleFileParseMode && DER.IncludedUndefinedIds) {
3482+
if (PPOpts.SingleFileParseMode && DER.IncludedUndefinedIds) {
34833483
// In 'single-file-parse mode' undefined identifiers trigger parsing of all
34843484
// the directive blocks.
34853485
CurPPLexer->pushConditionalLevel(IfToken.getLocation(), /*wasskip*/false,
@@ -3546,10 +3546,10 @@ void Preprocessor::HandleElseDirective(Token &Result, const Token &HashToken) {
35463546
if (Callbacks)
35473547
Callbacks->Else(Result.getLocation(), CI.IfLoc);
35483548

3549-
bool RetainExcludedCB = PPOpts->RetainExcludedConditionalBlocks &&
3549+
bool RetainExcludedCB = PPOpts.RetainExcludedConditionalBlocks &&
35503550
getSourceManager().isInMainFile(Result.getLocation());
35513551

3552-
if ((PPOpts->SingleFileParseMode && !CI.FoundNonSkip) || RetainExcludedCB) {
3552+
if ((PPOpts.SingleFileParseMode && !CI.FoundNonSkip) || RetainExcludedCB) {
35533553
// In 'single-file-parse mode' undefined identifiers trigger parsing of all
35543554
// the directive blocks.
35553555
CurPPLexer->pushConditionalLevel(CI.IfLoc, /*wasskip*/false,
@@ -3626,10 +3626,10 @@ void Preprocessor::HandleElifFamilyDirective(Token &ElifToken,
36263626
}
36273627
}
36283628

3629-
bool RetainExcludedCB = PPOpts->RetainExcludedConditionalBlocks &&
3629+
bool RetainExcludedCB = PPOpts.RetainExcludedConditionalBlocks &&
36303630
getSourceManager().isInMainFile(ElifToken.getLocation());
36313631

3632-
if ((PPOpts->SingleFileParseMode && !CI.FoundNonSkip) || RetainExcludedCB) {
3632+
if ((PPOpts.SingleFileParseMode && !CI.FoundNonSkip) || RetainExcludedCB) {
36333633
// In 'single-file-parse mode' undefined identifiers trigger parsing of all
36343634
// the directive blocks.
36353635
CurPPLexer->pushConditionalLevel(ElifToken.getLocation(), /*wasskip*/false,

clang/lib/Lex/PPLexerChange.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) {
561561
if (creatingPCHWithThroughHeader() && !LeavingPCHThroughHeader) {
562562
// Reached the end of the compilation without finding the through header.
563563
Diag(CurLexer->getFileLoc(), diag::err_pp_through_header_not_seen)
564-
<< PPOpts->PCHThroughHeader << 0;
564+
<< PPOpts.PCHThroughHeader << 0;
565565
}
566566

567567
if (!isIncrementalProcessingEnabled())

clang/lib/Lex/Preprocessor.cpp

+14-14
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ LLVM_INSTANTIATE_REGISTRY(PragmaHandlerRegistry)
7777

7878
ExternalPreprocessorSource::~ExternalPreprocessorSource() = default;
7979

80-
Preprocessor::Preprocessor(std::shared_ptr<const PreprocessorOptions> PPOpts,
80+
Preprocessor::Preprocessor(const PreprocessorOptions &PPOpts,
8181
DiagnosticsEngine &diags, const LangOptions &opts,
8282
SourceManager &SM, HeaderSearch &Headers,
8383
ModuleLoader &TheModuleLoader,
8484
IdentifierInfoLookup *IILookup, bool OwnsHeaders,
8585
TranslationUnitKind TUKind)
86-
: PPOpts(std::move(PPOpts)), Diags(&diags), LangOpts(opts),
86+
: PPOpts(PPOpts), Diags(&diags), LangOpts(opts),
8787
FileMgr(Headers.getFileMgr()), SourceMgr(SM),
8888
ScratchBuf(new ScratchBuffer(SourceMgr)), HeaderInfo(Headers),
8989
TheModuleLoader(TheModuleLoader), ExternalSource(nullptr),
@@ -156,11 +156,11 @@ Preprocessor::Preprocessor(std::shared_ptr<const PreprocessorOptions> PPOpts,
156156
SkippingUntilPragmaHdrStop = true;
157157

158158
// If using a PCH with a through header, start skipping tokens.
159-
if (!this->PPOpts->PCHThroughHeader.empty() &&
160-
!this->PPOpts->ImplicitPCHInclude.empty())
159+
if (!this->PPOpts.PCHThroughHeader.empty() &&
160+
!this->PPOpts.ImplicitPCHInclude.empty())
161161
SkippingUntilPCHThroughHeader = true;
162162

163-
if (this->PPOpts->GeneratePreamble)
163+
if (this->PPOpts.GeneratePreamble)
164164
PreambleConditionalStack.startRecording();
165165

166166
MaxTokens = LangOpts.MaxTokens;
@@ -577,18 +577,18 @@ void Preprocessor::EnterMainSourceFile() {
577577
// Start parsing the predefines.
578578
EnterSourceFile(FID, nullptr, SourceLocation());
579579

580-
if (!PPOpts->PCHThroughHeader.empty()) {
580+
if (!PPOpts.PCHThroughHeader.empty()) {
581581
// Lookup and save the FileID for the through header. If it isn't found
582582
// in the search path, it's a fatal error.
583583
OptionalFileEntryRef File = LookupFile(
584-
SourceLocation(), PPOpts->PCHThroughHeader,
584+
SourceLocation(), PPOpts.PCHThroughHeader,
585585
/*isAngled=*/false, /*FromDir=*/nullptr, /*FromFile=*/nullptr,
586586
/*CurDir=*/nullptr, /*SearchPath=*/nullptr, /*RelativePath=*/nullptr,
587587
/*SuggestedModule=*/nullptr, /*IsMapped=*/nullptr,
588588
/*IsFrameworkFound=*/nullptr);
589589
if (!File) {
590590
Diag(SourceLocation(), diag::err_pp_through_header_not_found)
591-
<< PPOpts->PCHThroughHeader;
591+
<< PPOpts.PCHThroughHeader;
592592
return;
593593
}
594594
setPCHThroughHeaderFileID(
@@ -614,21 +614,21 @@ bool Preprocessor::isPCHThroughHeader(const FileEntry *FE) {
614614
}
615615

616616
bool Preprocessor::creatingPCHWithThroughHeader() {
617-
return TUKind == TU_Prefix && !PPOpts->PCHThroughHeader.empty() &&
617+
return TUKind == TU_Prefix && !PPOpts.PCHThroughHeader.empty() &&
618618
PCHThroughHeaderFileID.isValid();
619619
}
620620

621621
bool Preprocessor::usingPCHWithThroughHeader() {
622-
return TUKind != TU_Prefix && !PPOpts->PCHThroughHeader.empty() &&
622+
return TUKind != TU_Prefix && !PPOpts.PCHThroughHeader.empty() &&
623623
PCHThroughHeaderFileID.isValid();
624624
}
625625

626626
bool Preprocessor::creatingPCHWithPragmaHdrStop() {
627-
return TUKind == TU_Prefix && PPOpts->PCHWithHdrStop;
627+
return TUKind == TU_Prefix && PPOpts.PCHWithHdrStop;
628628
}
629629

630630
bool Preprocessor::usingPCHWithPragmaHdrStop() {
631-
return TUKind != TU_Prefix && PPOpts->PCHWithHdrStop;
631+
return TUKind != TU_Prefix && PPOpts.PCHWithHdrStop;
632632
}
633633

634634
/// Skip tokens until after the #include of the through header or
@@ -657,8 +657,8 @@ void Preprocessor::SkipTokensWhileUsingPCH() {
657657
if (ReachedMainFileEOF) {
658658
if (UsingPCHThroughHeader)
659659
Diag(SourceLocation(), diag::err_pp_through_header_not_seen)
660-
<< PPOpts->PCHThroughHeader << 1;
661-
else if (!PPOpts->PCHWithHdrStopCreate)
660+
<< PPOpts.PCHThroughHeader << 1;
661+
else if (!PPOpts.PCHWithHdrStopCreate)
662662
Diag(SourceLocation(), diag::err_pp_pragma_hdrstop_not_seen);
663663
}
664664
}

clang/unittests/Analysis/MacroExpansionContextTest.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,10 @@ class MacroExpansionContextTest : public ::testing::Test {
6060
SourceMgr.setMainFileID(SourceMgr.createFileID(std::move(Buf)));
6161
HeaderSearchOptions HSOpts;
6262
TrivialModuleLoader ModLoader;
63+
PreprocessorOptions PPOpts;
6364
HeaderSearch HeaderInfo(HSOpts, SourceMgr, Diags, LangOpts, Target.get());
64-
Preprocessor PP(std::make_shared<PreprocessorOptions>(), Diags, LangOpts,
65-
SourceMgr, HeaderInfo, ModLoader,
66-
/*IILookup =*/nullptr,
67-
/*OwnsHeaderSearch =*/false);
65+
Preprocessor PP(PPOpts, Diags, LangOpts, SourceMgr, HeaderInfo, ModLoader,
66+
/*IILookup=*/nullptr, /*OwnsHeaderSearch=*/false);
6867

6968
PP.Initialize(*Target);
7069
auto Ctx = std::make_unique<MacroExpansionContext>(LangOpts);

clang/unittests/Basic/SourceManagerTest.cpp

+15-20
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,11 @@ TEST_F(SourceManagerTest, isBeforeInTranslationUnit) {
136136
SourceMgr.setMainFileID(mainFileID);
137137

138138
HeaderSearchOptions HSOpts;
139+
PreprocessorOptions PPOpts;
139140
TrivialModuleLoader ModLoader;
140141
HeaderSearch HeaderInfo(HSOpts, SourceMgr, Diags, LangOpts, &*Target);
141-
Preprocessor PP(std::make_shared<PreprocessorOptions>(), Diags, LangOpts,
142-
SourceMgr, HeaderInfo, ModLoader,
143-
/*IILookup =*/nullptr,
144-
/*OwnsHeaderSearch =*/false);
142+
Preprocessor PP(PPOpts, Diags, LangOpts, SourceMgr, HeaderInfo, ModLoader,
143+
/*IILookup =*/nullptr, /*OwnsHeaderSearch =*/false);
145144
PP.Initialize(*Target);
146145
PP.EnterMainSourceFile();
147146

@@ -186,12 +185,11 @@ TEST_F(SourceManagerTest, isBeforeInTranslationUnitWithTokenSplit) {
186185
SourceMgr.createFileID(llvm::MemoryBuffer::getMemBuffer(main)));
187186

188187
HeaderSearchOptions HSOpts;
188+
PreprocessorOptions PPOpts;
189189
TrivialModuleLoader ModLoader;
190190
HeaderSearch HeaderInfo(HSOpts, SourceMgr, Diags, LangOpts, &*Target);
191-
Preprocessor PP(std::make_shared<PreprocessorOptions>(), Diags, LangOpts,
192-
SourceMgr, HeaderInfo, ModLoader,
193-
/*IILookup =*/nullptr,
194-
/*OwnsHeaderSearch =*/false);
191+
Preprocessor PP(PPOpts, Diags, LangOpts, SourceMgr, HeaderInfo, ModLoader,
192+
/*IILookup=*/nullptr, /*OwnsHeaderSearch=*/false);
195193
PP.Initialize(*Target);
196194
PP.EnterMainSourceFile();
197195
llvm::SmallString<8> Scratch;
@@ -462,11 +460,10 @@ TEST_F(SourceManagerTest, ResetsIncludeLocMap) {
462460
auto ParseFile = [&] {
463461
TrivialModuleLoader ModLoader;
464462
HeaderSearchOptions HSOpts;
463+
PreprocessorOptions PPOpts;
465464
HeaderSearch HeaderInfo(HSOpts, SourceMgr, Diags, LangOpts, &*Target);
466-
Preprocessor PP(std::make_shared<PreprocessorOptions>(), Diags, LangOpts,
467-
SourceMgr, HeaderInfo, ModLoader,
468-
/*IILookup =*/nullptr,
469-
/*OwnsHeaderSearch =*/false);
465+
Preprocessor PP(PPOpts, Diags, LangOpts, SourceMgr, HeaderInfo, ModLoader,
466+
/*IILookup=*/nullptr, /*OwnsHeaderSearch=*/false);
470467
PP.Initialize(*Target);
471468
PP.EnterMainSourceFile();
472469
PP.LexTokensUntilEOF();
@@ -538,13 +535,12 @@ TEST_F(SourceManagerTest, getMacroArgExpandedLocation) {
538535
SourceMgr.overrideFileContents(headerFile, std::move(HeaderBuf));
539536

540537
HeaderSearchOptions HSOpts;
538+
PreprocessorOptions PPOpts;
541539
TrivialModuleLoader ModLoader;
542540
HeaderSearch HeaderInfo(HSOpts, SourceMgr, Diags, LangOpts, &*Target);
543541

544-
Preprocessor PP(std::make_shared<PreprocessorOptions>(), Diags, LangOpts,
545-
SourceMgr, HeaderInfo, ModLoader,
546-
/*IILookup =*/nullptr,
547-
/*OwnsHeaderSearch =*/false);
542+
Preprocessor PP(PPOpts, Diags, LangOpts, SourceMgr, HeaderInfo, ModLoader,
543+
/*IILookup=*/nullptr, /*OwnsHeaderSearch=*/false);
548544
// Ensure we can get expanded locations in presence of implicit includes.
549545
// These are different than normal includes since predefines buffer doesn't
550546
// have a valid insertion location.
@@ -657,12 +653,11 @@ TEST_F(SourceManagerTest, isBeforeInTranslationUnitWithMacroInInclude) {
657653
SourceMgr.overrideFileContents(headerFile, std::move(HeaderBuf));
658654

659655
HeaderSearchOptions HSOpts;
656+
PreprocessorOptions PPOpts;
660657
TrivialModuleLoader ModLoader;
661658
HeaderSearch HeaderInfo(HSOpts, SourceMgr, Diags, LangOpts, &*Target);
662-
Preprocessor PP(std::make_shared<PreprocessorOptions>(), Diags, LangOpts,
663-
SourceMgr, HeaderInfo, ModLoader,
664-
/*IILookup =*/nullptr,
665-
/*OwnsHeaderSearch =*/false);
659+
Preprocessor PP(PPOpts, Diags, LangOpts, SourceMgr, HeaderInfo, ModLoader,
660+
/*IILookup=*/nullptr, /*OwnsHeaderSearch=*/false);
666661
PP.Initialize(*Target);
667662

668663
std::vector<MacroAction> Macros;

clang/unittests/Lex/LexerTest.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ class LexerTest : public ::testing::Test {
5959

6060
HeaderSearchOptions HSOpts;
6161
HeaderSearch HeaderInfo(HSOpts, SourceMgr, Diags, LangOpts, Target.get());
62+
PreprocessorOptions PPOpts;
6263
std::unique_ptr<Preprocessor> PP = std::make_unique<Preprocessor>(
63-
std::make_shared<PreprocessorOptions>(), Diags, LangOpts, SourceMgr,
64-
HeaderInfo, ModLoader,
64+
PPOpts, Diags, LangOpts, SourceMgr, HeaderInfo, ModLoader,
6565
/*IILookup =*/nullptr,
6666
/*OwnsHeaderSearch =*/false);
6767
PP->Initialize(*Target);

0 commit comments

Comments
 (0)