Skip to content

Commit 985410f

Browse files
authored
[clang] Hide the TargetOptions pointer from CompilerInvocation (#106271)
This PR hides the reference-counted pointer that holds `TargetOptions` from the public API of `CompilerInvocation`. This gives `CompilerInvocation` an exclusive control over the lifetime of this member, which will eventually be leveraged to implement a copy-on-write behavior. There are two clients that currently share ownership of that pointer: * `TargetInfo` - This was refactored to hold a non-owning reference to `TargetOptions`. The options object is typically owned by the `CompilerInvocation` or by the new `CompilerInstance::AuxTargetOpts` for the auxiliary target. This needed a bit of care in `ASTUnit::Parse()` to keep the `CompilerInvocation` alive. * `clangd::PreambleData` - This was refactored to exclusively own the `TargetOptions` that get moved out of the `CompilerInvocation`.
1 parent ba420d8 commit 985410f

30 files changed

+50
-39
lines changed

clang-tools-extra/clangd/Preamble.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,10 @@ buildPreamble(PathRef FileName, CompilerInvocation CI,
711711
Result->Marks = CapturedInfo.takeMarks();
712712
Result->StatCache = StatCache;
713713
Result->MainIsIncludeGuarded = CapturedInfo.isMainFileIncludeGuarded();
714-
Result->TargetOpts = CI.TargetOpts;
714+
// Move the options instead of copying them. The invocation doesn't need
715+
// them anymore.
716+
Result->TargetOpts =
717+
std::make_unique<TargetOptions>(std::move(CI.getTargetOpts()));
715718
if (PreambleCallback) {
716719
trace::Span Tracer("Running PreambleCallback");
717720
auto Ctx = CapturedInfo.takeLife();
@@ -932,7 +935,7 @@ void PreamblePatch::apply(CompilerInvocation &CI) const {
932935
// ParsedASTTest.PreambleWithDifferentTarget.
933936
// Make sure this is a deep copy, as the same Baseline might be used
934937
// concurrently.
935-
*CI.TargetOpts = *Baseline->TargetOpts;
938+
CI.getTargetOpts() = *Baseline->TargetOpts;
936939

937940
// No need to map an empty file.
938941
if (PatchContents.empty())

clang-tools-extra/clangd/Preamble.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ struct PreambleData {
103103
// Target options used when building the preamble. Changes in target can cause
104104
// crashes when deserializing preamble, this enables consumers to use the
105105
// same target (without reparsing CompileCommand).
106-
std::shared_ptr<TargetOptions> TargetOpts = nullptr;
106+
std::unique_ptr<TargetOptions> TargetOpts = nullptr;
107107
PrecompiledPreamble Preamble;
108108
std::vector<Diag> Diags;
109109
// Processes like code completions and go-to-definitions will need #include

clang-tools-extra/clangd/SystemIncludeExtractor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ bool isValidTarget(llvm::StringRef Triple) {
256256
DiagnosticsEngine Diags(new DiagnosticIDs, new DiagnosticOptions,
257257
new IgnoringDiagConsumer);
258258
llvm::IntrusiveRefCntPtr<TargetInfo> Target =
259-
TargetInfo::CreateTargetInfo(Diags, TargetOpts);
259+
TargetInfo::CreateTargetInfo(Diags, *TargetOpts);
260260
return bool(Target);
261261
}
262262

clang-tools-extra/modularize/ModularizeUtilities.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ ModularizeUtilities::ModularizeUtilities(std::vector<std::string> &InputPaths,
5353
Diagnostics(
5454
new DiagnosticsEngine(DiagIDs, DiagnosticOpts.get(), &DC, false)),
5555
TargetOpts(new ModuleMapTargetOptions()),
56-
Target(TargetInfo::CreateTargetInfo(*Diagnostics, TargetOpts)),
56+
Target(TargetInfo::CreateTargetInfo(*Diagnostics, *TargetOpts)),
5757
FileMgr(new FileManager(FileSystemOpts)),
5858
SourceMgr(new SourceManager(*Diagnostics, *FileMgr, false)), HSOpts(),
5959
HeaderInfo(new HeaderSearch(HSOpts, *SourceMgr, *Diagnostics, *LangOpts,

clang/include/clang/Basic/TargetInfo.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ enum OpenCLTypeKind : uint8_t {
224224
///
225225
class TargetInfo : public TransferrableTargetInfo,
226226
public RefCountedBase<TargetInfo> {
227-
std::shared_ptr<TargetOptions> TargetOpts;
227+
TargetOptions *TargetOpts;
228228
llvm::Triple Triple;
229229
protected:
230230
// Target values set by the ctor of the actual target implementation. Default
@@ -310,10 +310,9 @@ class TargetInfo : public TransferrableTargetInfo,
310310
///
311311
/// \param Opts - The options to use to initialize the target. The target may
312312
/// modify the options to canonicalize the target feature information to match
313-
/// what the backend expects.
314-
static TargetInfo *
315-
CreateTargetInfo(DiagnosticsEngine &Diags,
316-
const std::shared_ptr<TargetOptions> &Opts);
313+
/// what the backend expects. These must outlive the returned TargetInfo.
314+
static TargetInfo *CreateTargetInfo(DiagnosticsEngine &Diags,
315+
TargetOptions &Opts);
317316

318317
virtual ~TargetInfo();
319318

clang/include/clang/Frontend/ASTUnit.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ class ASTUnit {
143143
/// Parse available.
144144
std::shared_ptr<CompilerInvocation> CCInvocation;
145145

146+
/// Optional owned invocation, just used to keep the invocation alive for the
147+
/// members initialized in transferASTDataFromCompilerInstance.
148+
std::shared_ptr<CompilerInvocation> ModifiedInvocation;
149+
146150
/// Fake module loader: the AST unit doesn't need to load any modules.
147151
TrivialModuleLoader ModuleLoader;
148152

clang/include/clang/Frontend/CompilerInstance.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ class CompilerInstance : public ModuleLoader {
8888
/// The target being compiled for.
8989
IntrusiveRefCntPtr<TargetInfo> Target;
9090

91+
/// Options for the auxiliary target.
92+
std::unique_ptr<TargetOptions> AuxTargetOpts;
93+
9194
/// Auxiliary Target info.
9295
IntrusiveRefCntPtr<TargetInfo> AuxTarget;
9396

clang/include/clang/Frontend/CompilerInvocation.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ class CompilerInvocation : public CompilerInvocationBase {
268268
/// Base class internals.
269269
/// @{
270270
using CompilerInvocationBase::LangOpts;
271-
using CompilerInvocationBase::TargetOpts;
272271
std::shared_ptr<LangOptions> getLangOptsPtr() { return LangOpts; }
273272
/// @}
274273

clang/lib/Basic/Targets.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,9 +774,10 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
774774
using namespace clang::targets;
775775
/// CreateTargetInfo - Return the target info object for the specified target
776776
/// options.
777-
TargetInfo *
778-
TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags,
779-
const std::shared_ptr<TargetOptions> &Opts) {
777+
TargetInfo *TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags,
778+
TargetOptions &OptsRef) {
779+
TargetOptions *Opts = &OptsRef;
780+
780781
llvm::Triple Triple(llvm::Triple::normalize(Opts->Triple));
781782

782783
// Construct the target

clang/lib/Frontend/ASTUnit.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ class ASTInfoCollector : public ASTReaderListener {
615615

616616
this->TargetOpts = std::make_shared<TargetOptions>(TargetOpts);
617617
Target =
618-
TargetInfo::CreateTargetInfo(PP.getDiagnostics(), this->TargetOpts);
618+
TargetInfo::CreateTargetInfo(PP.getDiagnostics(), *this->TargetOpts);
619619

620620
updated();
621621
return false;
@@ -1499,6 +1499,10 @@ void ASTUnit::transferASTDataFromCompilerInstance(CompilerInstance &CI) {
14991499
Target = &CI.getTarget();
15001500
Reader = CI.getASTReader();
15011501
HadModuleLoaderFatalFailure = CI.hadModuleLoaderFatalFailure();
1502+
if (Invocation != CI.getInvocationPtr()) {
1503+
// This happens when Parse creates a copy of \c Invocation to modify.
1504+
ModifiedInvocation = CI.getInvocationPtr();
1505+
}
15021506
}
15031507

15041508
StringRef ASTUnit::getMainFileName() const {

clang/lib/Frontend/ChainedIncludesSource.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ IntrusiveRefCntPtr<ExternalSemaSource> clang::createChainedIncludesSource(
127127
Clang->setInvocation(std::move(CInvok));
128128
Clang->setDiagnostics(Diags.get());
129129
Clang->setTarget(TargetInfo::CreateTargetInfo(
130-
Clang->getDiagnostics(), Clang->getInvocation().TargetOpts));
130+
Clang->getDiagnostics(), Clang->getInvocation().getTargetOpts()));
131131
Clang->createFileManager();
132132
Clang->createSourceManager(Clang->getFileManager());
133133
Clang->createPreprocessor(TU_Prefix);

clang/lib/Frontend/CompilerInstance.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void CompilerInstance::setAuxTarget(TargetInfo *Value) { AuxTarget = Value; }
110110
bool CompilerInstance::createTarget() {
111111
// Create the target instance.
112112
setTarget(TargetInfo::CreateTargetInfo(getDiagnostics(),
113-
getInvocation().TargetOpts));
113+
getInvocation().getTargetOpts()));
114114
if (!hasTarget())
115115
return false;
116116

@@ -119,14 +119,14 @@ bool CompilerInstance::createTarget() {
119119
if (!getAuxTarget() &&
120120
(getLangOpts().CUDA || getLangOpts().isTargetDevice()) &&
121121
!getFrontendOpts().AuxTriple.empty()) {
122-
auto TO = std::make_shared<TargetOptions>();
122+
auto &TO = AuxTargetOpts = std::make_unique<TargetOptions>();
123123
TO->Triple = llvm::Triple::normalize(getFrontendOpts().AuxTriple);
124124
if (getFrontendOpts().AuxTargetCPU)
125125
TO->CPU = *getFrontendOpts().AuxTargetCPU;
126126
if (getFrontendOpts().AuxTargetFeatures)
127127
TO->FeaturesAsWritten = *getFrontendOpts().AuxTargetFeatures;
128128
TO->HostTriple = getTarget().getTriple().str();
129-
setAuxTarget(TargetInfo::CreateTargetInfo(getDiagnostics(), TO));
129+
setAuxTarget(TargetInfo::CreateTargetInfo(getDiagnostics(), *TO));
130130
}
131131

132132
if (!getTarget().hasStrictFP() && !getLangOpts().ExpStrictFP) {

clang/lib/Interpreter/Interpreter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ CreateCI(const llvm::opt::ArgStringList &Argv) {
125125
Clang->getPreprocessorOpts().addRemappedFile("<<< inputs >>>", MB);
126126

127127
Clang->setTarget(TargetInfo::CreateTargetInfo(
128-
Clang->getDiagnostics(), Clang->getInvocation().TargetOpts));
128+
Clang->getDiagnostics(), Clang->getInvocation().getTargetOpts()));
129129
if (!Clang->hasTarget())
130130
return llvm::createStringError(llvm::errc::not_supported,
131131
"Initialization failed. "

clang/tools/clang-import-test/clang-import-test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ std::unique_ptr<CompilerInstance> BuildCompilerInstance() {
208208
Ins->setInvocation(std::move(Inv));
209209

210210
TargetInfo *TI = TargetInfo::CreateTargetInfo(
211-
Ins->getDiagnostics(), Ins->getInvocation().TargetOpts);
211+
Ins->getDiagnostics(), Ins->getInvocation().getTargetOpts());
212212
Ins->setTarget(TI);
213213
Ins->getTarget().adjust(Ins->getDiagnostics(), Ins->getLangOpts());
214214
Ins->createFileManager();

clang/unittests/Analysis/MacroExpansionContextTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class MacroExpansionContextTest : public ::testing::Test {
3939
Diags(DiagID, DiagOpts.get(), new IgnoringDiagConsumer()),
4040
SourceMgr(Diags, FileMgr), TargetOpts(new TargetOptions()) {
4141
TargetOpts->Triple = "x86_64-pc-linux-unknown";
42-
Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
42+
Target = TargetInfo::CreateTargetInfo(Diags, *TargetOpts);
4343
LangOpts.CPlusPlus20 = 1; // For __VA_OPT__
4444
}
4545

clang/unittests/Basic/SourceManagerTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class SourceManagerTest : public ::testing::Test {
4646
SourceMgr(Diags, FileMgr),
4747
TargetOpts(new TargetOptions) {
4848
TargetOpts->Triple = "x86_64-apple-darwin11.1.0";
49-
Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
49+
Target = TargetInfo::CreateTargetInfo(Diags, *TargetOpts);
5050
}
5151

5252
FileSystemOptions FileMgrOpts;

clang/unittests/CodeGen/TestCompiler.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ struct TestCompiler {
4545
Tr.setEnvironment(Triple::EnvironmentType::UnknownEnvironment);
4646
compiler.getTargetOpts().Triple = Tr.getTriple();
4747
compiler.setTarget(clang::TargetInfo::CreateTargetInfo(
48-
compiler.getDiagnostics(),
49-
std::make_shared<clang::TargetOptions>(compiler.getTargetOpts())));
48+
compiler.getDiagnostics(), compiler.getTargetOpts()));
5049

5150
const clang::TargetInfo &TInfo = compiler.getTarget();
5251
PtrSize = TInfo.getPointerWidth(clang::LangAS::Default) / 8;

clang/unittests/Driver/ToolChainTest.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,7 @@ TEST(ToolChainTest, UEFICallingConventionTest) {
589589

590590
compiler.getTargetOpts().Triple = Tr.getTriple();
591591
compiler.setTarget(clang::TargetInfo::CreateTargetInfo(
592-
compiler.getDiagnostics(),
593-
std::make_shared<clang::TargetOptions>(compiler.getTargetOpts())));
592+
compiler.getDiagnostics(), compiler.getTargetOpts()));
594593

595594
EXPECT_EQ(compiler.getTarget().getCallingConvKind(true),
596595
TargetInfo::CallingConvKind::CCK_MicrosoftWin64);

clang/unittests/Frontend/UtilsTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ TEST(BuildCompilerInvocationTest, RecoverMultipleJobs) {
3333
*Opts.VFS, new DiagnosticOptions, &D, false);
3434
std::unique_ptr<CompilerInvocation> CI = createInvocation(Args, Opts);
3535
ASSERT_TRUE(CI);
36-
EXPECT_THAT(CI->TargetOpts->Triple, testing::StartsWith("i386-"));
36+
EXPECT_THAT(CI->getTargetOpts().Triple, testing::StartsWith("i386-"));
3737
}
3838

3939
// buildInvocationFromCommandLine should not translate -include to -include-pch,

clang/unittests/Lex/HeaderSearchTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class HeaderSearchTest : public ::testing::Test {
3434
SourceMgr(Diags, FileMgr), TargetOpts(new TargetOptions),
3535
Search(HSOpts, SourceMgr, Diags, LangOpts, Target.get()) {
3636
TargetOpts->Triple = "x86_64-apple-darwin11.1.0";
37-
Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
37+
Target = TargetInfo::CreateTargetInfo(Diags, *TargetOpts);
3838
}
3939

4040
void addSearchDir(llvm::StringRef Dir) {

clang/unittests/Lex/LexerTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class LexerTest : public ::testing::Test {
4848
TargetOpts(new TargetOptions)
4949
{
5050
TargetOpts->Triple = "x86_64-apple-darwin11.1.0";
51-
Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
51+
Target = TargetInfo::CreateTargetInfo(Diags, *TargetOpts);
5252
}
5353

5454
std::unique_ptr<Preprocessor> CreatePP(StringRef Source,

clang/unittests/Lex/ModuleDeclStateTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ModuleDeclStateTest : public ::testing::Test {
5858
Diags(DiagID, new DiagnosticOptions, new IgnoringDiagConsumer()),
5959
SourceMgr(Diags, FileMgr), TargetOpts(new TargetOptions) {
6060
TargetOpts->Triple = "x86_64-unknown-linux-gnu";
61-
Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
61+
Target = TargetInfo::CreateTargetInfo(Diags, *TargetOpts);
6262
}
6363

6464
std::unique_ptr<Preprocessor>

clang/unittests/Lex/PPCallbacksTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class PPCallbacksTest : public ::testing::Test {
139139
Diags(DiagID, DiagOpts.get(), new IgnoringDiagConsumer()),
140140
SourceMgr(Diags, FileMgr), TargetOpts(new TargetOptions()) {
141141
TargetOpts->Triple = "x86_64-apple-darwin11.1.0";
142-
Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
142+
Target = TargetInfo::CreateTargetInfo(Diags, *TargetOpts);
143143
}
144144

145145
IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem;

clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class PPConditionalDirectiveRecordTest : public ::testing::Test {
3636
TargetOpts(new TargetOptions)
3737
{
3838
TargetOpts->Triple = "x86_64-apple-darwin11.1.0";
39-
Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
39+
Target = TargetInfo::CreateTargetInfo(Diags, *TargetOpts);
4040
}
4141

4242
FileSystemOptions FileMgrOpts;

clang/unittests/Lex/PPDependencyDirectivesTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class PPDependencyDirectivesTest : public ::testing::Test {
3535
Diags(DiagID, new DiagnosticOptions, new IgnoringDiagConsumer()),
3636
SourceMgr(Diags, FileMgr), TargetOpts(new TargetOptions) {
3737
TargetOpts->Triple = "x86_64-apple-macos12";
38-
Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
38+
Target = TargetInfo::CreateTargetInfo(Diags, *TargetOpts);
3939
}
4040

4141
FileSystemOptions FileMgrOpts;

clang/unittests/Lex/PPMemoryAllocationsTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class PPMemoryAllocationsTest : public ::testing::Test {
3131
Diags(DiagID, new DiagnosticOptions, new IgnoringDiagConsumer()),
3232
SourceMgr(Diags, FileMgr), TargetOpts(new TargetOptions) {
3333
TargetOpts->Triple = "x86_64-apple-darwin11.1.0";
34-
Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
34+
Target = TargetInfo::CreateTargetInfo(Diags, *TargetOpts);
3535
}
3636

3737
FileSystemOptions FileMgrOpts;

clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class ParseHLSLRootSignatureTest : public ::testing::Test {
7272
SourceMgr(Diags, FileMgr), TargetOpts(new TargetOptions) {
7373
// This is an arbitrarily chosen target triple to create the target info.
7474
TargetOpts->Triple = "dxil";
75-
Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
75+
Target = TargetInfo::CreateTargetInfo(Diags, *TargetOpts);
7676
}
7777

7878
std::unique_ptr<Preprocessor> createPP(StringRef Source,

lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ ClangExpressionParser::ClangExpressionParser(
789789

790790
if (auto *target_info = TargetInfo::CreateTargetInfo(
791791
m_compiler->getDiagnostics(),
792-
m_compiler->getInvocation().TargetOpts)) {
792+
m_compiler->getInvocation().getTargetOpts())) {
793793
if (log) {
794794
LLDB_LOGF(log, "Target datalayout string: '%s'",
795795
target_info->getDataLayoutString());

lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ ClangModulesDeclVendor::Create(Target &target) {
742742
std::unique_ptr<clang::FrontendAction> action(new clang::SyntaxOnlyAction);
743743

744744
instance->setTarget(clang::TargetInfo::CreateTargetInfo(
745-
*diagnostics_engine, instance->getInvocation().TargetOpts));
745+
*diagnostics_engine, instance->getInvocation().getTargetOpts()));
746746

747747
if (!instance->hasTarget())
748748
return nullptr;

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ TargetInfo *TypeSystemClang::getTargetInfo() {
744744
// target_triple should be something like "x86_64-apple-macosx"
745745
if (m_target_info_up == nullptr && !m_target_triple.empty())
746746
m_target_info_up.reset(TargetInfo::CreateTargetInfo(
747-
getASTContext().getDiagnostics(), getTargetOptions()));
747+
getASTContext().getDiagnostics(), *getTargetOptions()));
748748
return m_target_info_up.get();
749749
}
750750

0 commit comments

Comments
 (0)