Skip to content

Commit 4aa3377

Browse files
committed
[clang] NFCI: Change returned LanguageOptions pointer to reference
1 parent 7f8a88f commit 4aa3377

23 files changed

+124
-128
lines changed

clang-tools-extra/clangd/ClangdServer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct UpdateIndexCallbacks : public ParsingCallbacks {
8383

8484
auto &PP = ASTCtx.getPreprocessor();
8585
auto &CI = ASTCtx.getCompilerInvocation();
86-
if (auto Loc = Stdlib->add(*CI.getLangOpts(), PP.getHeaderSearchInfo()))
86+
if (auto Loc = Stdlib->add(CI.getLangOpts(), PP.getHeaderSearchInfo()))
8787
indexStdlib(CI, std::move(*Loc));
8888

8989
// FIndex outlives the UpdateIndexCallbacks.
@@ -105,7 +105,7 @@ struct UpdateIndexCallbacks : public ParsingCallbacks {
105105
// This task is owned by Tasks, which outlives the TUScheduler and
106106
// therefore the UpdateIndexCallbacks.
107107
// We must be careful that the references we capture outlive TUScheduler.
108-
auto Task = [LO(*CI.getLangOpts()), Loc(std::move(Loc)),
108+
auto Task = [LO(CI.getLangOpts()), Loc(std::move(Loc)),
109109
CI(std::make_unique<CompilerInvocation>(CI)),
110110
// External values that outlive ClangdServer
111111
TFS(&TFS),

clang-tools-extra/clangd/CodeComplete.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,11 +1356,11 @@ bool semaCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer,
13561356
auto &FrontendOpts = CI->getFrontendOpts();
13571357
FrontendOpts.SkipFunctionBodies = true;
13581358
// Disable typo correction in Sema.
1359-
CI->getLangOpts()->SpellChecking = false;
1359+
CI->getLangOpts().SpellChecking = false;
13601360
// Code completion won't trigger in delayed template bodies.
13611361
// This is on-by-default in windows to allow parsing SDK headers; we're only
13621362
// disabling it for the main-file (not preamble).
1363-
CI->getLangOpts()->DelayedTemplateParsing = false;
1363+
CI->getLangOpts().DelayedTemplateParsing = false;
13641364
// Setup code completion.
13651365
FrontendOpts.CodeCompleteOpts = Options;
13661366
FrontendOpts.CodeCompletionAt.FileName = std::string(Input.FileName);
@@ -1380,7 +1380,7 @@ bool semaCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer,
13801380
// overriding the preamble will break sema completion. Fortunately we can just
13811381
// skip all includes in this case; these completions are really simple.
13821382
PreambleBounds PreambleRegion =
1383-
ComputePreambleBounds(*CI->getLangOpts(), *ContentsBuffer, 0);
1383+
ComputePreambleBounds(CI->getLangOpts(), *ContentsBuffer, 0);
13841384
bool CompletingInPreamble = Input.Offset < PreambleRegion.Size ||
13851385
(!PreambleRegion.PreambleEndsAtStartOfLine &&
13861386
Input.Offset == PreambleRegion.Size);

clang-tools-extra/clangd/Compiler.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ void disableUnsupportedOptions(CompilerInvocation &CI) {
8484
// These options mostly affect codegen, and aren't relevant to clangd. And
8585
// clang will die immediately when these files are not existed.
8686
// Disable these uninteresting options to make clangd more robust.
87-
CI.getLangOpts()->NoSanitizeFiles.clear();
88-
CI.getLangOpts()->XRayAttrListFiles.clear();
89-
CI.getLangOpts()->ProfileListFiles.clear();
90-
CI.getLangOpts()->XRayAlwaysInstrumentFiles.clear();
91-
CI.getLangOpts()->XRayNeverInstrumentFiles.clear();
87+
CI.getLangOpts().NoSanitizeFiles.clear();
88+
CI.getLangOpts().XRayAttrListFiles.clear();
89+
CI.getLangOpts().ProfileListFiles.clear();
90+
CI.getLangOpts().XRayAlwaysInstrumentFiles.clear();
91+
CI.getLangOpts().XRayNeverInstrumentFiles.clear();
9292
}
9393

9494
std::unique_ptr<CompilerInvocation>
@@ -118,8 +118,8 @@ buildCompilerInvocation(const ParseInputs &Inputs, clang::DiagnosticConsumer &D,
118118
return nullptr;
119119
// createInvocationFromCommandLine sets DisableFree.
120120
CI->getFrontendOpts().DisableFree = false;
121-
CI->getLangOpts()->CommentOpts.ParseAllComments = true;
122-
CI->getLangOpts()->RetainCommentsFromSystemHeaders = true;
121+
CI->getLangOpts().CommentOpts.ParseAllComments = true;
122+
CI->getLangOpts().RetainCommentsFromSystemHeaders = true;
123123

124124
disableUnsupportedOptions(*CI);
125125
return CI;

clang-tools-extra/clangd/ParsedAST.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs,
404404

405405
// This is on-by-default in windows to allow parsing SDK headers, but it
406406
// breaks many features. Disable it for the main-file (not preamble).
407-
CI->getLangOpts()->DelayedTemplateParsing = false;
407+
CI->getLangOpts().DelayedTemplateParsing = false;
408408

409409
std::vector<std::unique_ptr<FeatureModule::ASTListener>> ASTListeners;
410410
if (Inputs.FeatureModules) {

clang-tools-extra/clangd/Preamble.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ scanPreamble(llvm::StringRef Contents, const tooling::CompileCommand &Cmd) {
365365
// This means we're scanning (though not preprocessing) the preamble section
366366
// twice. However, it's important to precisely follow the preamble bounds used
367367
// elsewhere.
368-
auto Bounds = ComputePreambleBounds(*CI->getLangOpts(), *ContentsBuffer, 0);
368+
auto Bounds = ComputePreambleBounds(CI->getLangOpts(), *ContentsBuffer, 0);
369369
auto PreambleContents = llvm::MemoryBuffer::getMemBufferCopy(
370370
llvm::StringRef(PI.Contents).take_front(Bounds.Size));
371371
auto Clang = prepareCompilerInstance(
@@ -596,7 +596,7 @@ buildPreamble(PathRef FileName, CompilerInvocation CI,
596596
// without those.
597597
auto ContentsBuffer =
598598
llvm::MemoryBuffer::getMemBuffer(Inputs.Contents, FileName);
599-
auto Bounds = ComputePreambleBounds(*CI.getLangOpts(), *ContentsBuffer, 0);
599+
auto Bounds = ComputePreambleBounds(CI.getLangOpts(), *ContentsBuffer, 0);
600600

601601
trace::Span Tracer("BuildPreamble");
602602
SPAN_ATTACH(Tracer, "File", FileName);
@@ -622,7 +622,7 @@ buildPreamble(PathRef FileName, CompilerInvocation CI,
622622
const clang::Diagnostic &Info) {
623623
if (Cfg.Diagnostics.SuppressAll ||
624624
isBuiltinDiagnosticSuppressed(Info.getID(), Cfg.Diagnostics.Suppress,
625-
*CI.getLangOpts()))
625+
CI.getLangOpts()))
626626
return DiagnosticsEngine::Ignored;
627627
switch (Info.getID()) {
628628
case diag::warn_no_newline_eof:
@@ -727,7 +727,7 @@ bool isPreambleCompatible(const PreambleData &Preamble,
727727
const CompilerInvocation &CI) {
728728
auto ContentsBuffer =
729729
llvm::MemoryBuffer::getMemBuffer(Inputs.Contents, FileName);
730-
auto Bounds = ComputePreambleBounds(*CI.getLangOpts(), *ContentsBuffer, 0);
730+
auto Bounds = ComputePreambleBounds(CI.getLangOpts(), *ContentsBuffer, 0);
731731
auto VFS = Inputs.TFS->view(Inputs.CompileCommand.Directory);
732732
return compileCommandsAreEqual(Inputs.CompileCommand,
733733
Preamble.CompileCommand) &&

clang-tools-extra/clangd/index/StdLib.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ SymbolSlab indexStandardLibrary(llvm::StringRef HeaderSources,
207207
}
208208
const FrontendInputFile &Input = CI->getFrontendOpts().Inputs.front();
209209
trace::Span Tracer("StandardLibraryIndex");
210-
LangStandard::Kind LangStd = standardFromOpts(*CI->getLangOpts());
210+
LangStandard::Kind LangStd = standardFromOpts(CI->getLangOpts());
211211
log("Indexing {0} standard library in the context of {1}",
212212
LangStandard::getLangStandardForKind(LangStd).getName(), Input.getFile());
213213

@@ -267,7 +267,7 @@ SymbolSlab indexStandardLibrary(llvm::StringRef HeaderSources,
267267
SymbolSlab indexStandardLibrary(std::unique_ptr<CompilerInvocation> Invocation,
268268
const StdLibLocation &Loc,
269269
const ThreadsafeFS &TFS) {
270-
llvm::StringRef Header = getStdlibUmbrellaHeader(*Invocation->getLangOpts());
270+
llvm::StringRef Header = getStdlibUmbrellaHeader(Invocation->getLangOpts());
271271
return indexStandardLibrary(Header, std::move(Invocation), Loc, TFS);
272272
}
273273

clang-tools-extra/clangd/unittests/PreambleTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ collectPatchedIncludes(llvm::StringRef ModifiedContents,
8888
// introduced by the patch is parsed and nothing else.
8989
// We don't run PP directly over the patch cotents to test production
9090
// behaviour.
91-
auto Bounds = Lexer::ComputePreamble(ModifiedContents, *CI->getLangOpts());
91+
auto Bounds = Lexer::ComputePreamble(ModifiedContents, CI->getLangOpts());
9292
auto Clang =
9393
prepareCompilerInstance(std::move(CI), &BaselinePreamble->Preamble,
9494
llvm::MemoryBuffer::getMemBufferCopy(
@@ -588,7 +588,7 @@ TEST(PreamblePatch, ModifiedBounds) {
588588
ASSERT_TRUE(CI);
589589

590590
const auto ExpectedBounds =
591-
Lexer::ComputePreamble(Case.Modified, *CI->getLangOpts());
591+
Lexer::ComputePreamble(Case.Modified, CI->getLangOpts());
592592
EXPECT_EQ(PP.modifiedBounds().Size, ExpectedBounds.Size);
593593
EXPECT_EQ(PP.modifiedBounds().PreambleEndsAtStartOfLine,
594594
ExpectedBounds.PreambleEndsAtStartOfLine);

clang/include/clang/Frontend/CompilerInstance.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,8 @@ class CompilerInstance : public ModuleLoader {
326326
return Invocation->getAPINotesOpts();
327327
}
328328

329-
LangOptions &getLangOpts() {
330-
return *Invocation->getLangOpts();
331-
}
332-
const LangOptions &getLangOpts() const {
333-
return *Invocation->getLangOpts();
334-
}
329+
LangOptions &getLangOpts() { return Invocation->getLangOpts(); }
330+
const LangOptions &getLangOpts() const { return Invocation->getLangOpts(); }
335331

336332
PreprocessorOptions &getPreprocessorOpts() {
337333
return Invocation->getPreprocessorOpts();

clang/include/clang/Frontend/CompilerInvocation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ class CompilerInvocationRefBase {
108108
CompilerInvocationRefBase &operator=(CompilerInvocationRefBase &&X);
109109
~CompilerInvocationRefBase();
110110

111-
LangOptions *getLangOpts() { return LangOpts.get(); }
112-
const LangOptions *getLangOpts() const { return LangOpts.get(); }
111+
LangOptions &getLangOpts() { return *LangOpts; }
112+
const LangOptions &getLangOpts() const { return *LangOpts; }
113113

114114
TargetOptions &getTargetOpts() { return *TargetOpts.get(); }
115115
const TargetOptions &getTargetOpts() const { return *TargetOpts.get(); }

clang/lib/ARCMigrate/ARCMT.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ createInvocationForMigration(CompilerInvocation &origCI,
191191
std::string define = std::string(getARCMTMacroName());
192192
define += '=';
193193
CInvok->getPreprocessorOpts().addMacroDef(define);
194-
CInvok->getLangOpts()->ObjCAutoRefCount = true;
195-
CInvok->getLangOpts()->setGC(LangOptions::NonGC);
194+
CInvok->getLangOpts().ObjCAutoRefCount = true;
195+
CInvok->getLangOpts().setGC(LangOptions::NonGC);
196196
CInvok->getDiagnosticOpts().ErrorLimit = 0;
197197
CInvok->getDiagnosticOpts().PedanticErrors = 0;
198198

@@ -207,8 +207,8 @@ createInvocationForMigration(CompilerInvocation &origCI,
207207
WarnOpts.push_back("error=arc-unsafe-retained-assign");
208208
CInvok->getDiagnosticOpts().Warnings = std::move(WarnOpts);
209209

210-
CInvok->getLangOpts()->ObjCWeakRuntime = HasARCRuntime(origCI);
211-
CInvok->getLangOpts()->ObjCWeak = CInvok->getLangOpts()->ObjCWeakRuntime;
210+
CInvok->getLangOpts().ObjCWeakRuntime = HasARCRuntime(origCI);
211+
CInvok->getLangOpts().ObjCWeak = CInvok->getLangOpts().ObjCWeakRuntime;
212212

213213
return CInvok.release();
214214
}
@@ -237,10 +237,10 @@ bool arcmt::checkForManualIssues(
237237
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
238238
DiagnosticConsumer *DiagClient, bool emitPremigrationARCErrors,
239239
StringRef plistOut) {
240-
if (!origCI.getLangOpts()->ObjC)
240+
if (!origCI.getLangOpts().ObjC)
241241
return false;
242242

243-
LangOptions::GCMode OrigGCMode = origCI.getLangOpts()->getGC();
243+
LangOptions::GCMode OrigGCMode = origCI.getLangOpts().getGC();
244244
bool NoNSAllocReallocError = origCI.getMigratorOpts().NoNSAllocReallocError;
245245
bool NoFinalizeRemoval = origCI.getMigratorOpts().NoFinalizeRemoval;
246246

@@ -338,10 +338,10 @@ applyTransforms(CompilerInvocation &origCI, const FrontendInputFile &Input,
338338
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
339339
DiagnosticConsumer *DiagClient, StringRef outputDir,
340340
bool emitPremigrationARCErrors, StringRef plistOut) {
341-
if (!origCI.getLangOpts()->ObjC)
341+
if (!origCI.getLangOpts().ObjC)
342342
return false;
343343

344-
LangOptions::GCMode OrigGCMode = origCI.getLangOpts()->getGC();
344+
LangOptions::GCMode OrigGCMode = origCI.getLangOpts().getGC();
345345

346346
// Make sure checking is successful first.
347347
CompilerInvocation CInvokForCheck(origCI);
@@ -372,7 +372,7 @@ applyTransforms(CompilerInvocation &origCI, const FrontendInputFile &Input,
372372
DiagClient, /*ShouldOwnClient=*/false));
373373

374374
if (outputDir.empty()) {
375-
origCI.getLangOpts()->ObjCAutoRefCount = true;
375+
origCI.getLangOpts().ObjCAutoRefCount = true;
376376
return migration.getRemapper().overwriteOriginal(*Diags);
377377
} else {
378378
return migration.getRemapper().flushToDisk(outputDir, *Diags);
@@ -577,7 +577,7 @@ bool MigrationProcess::applyTransform(TransformFn trans,
577577

578578
Rewriter rewriter(Ctx.getSourceManager(), Ctx.getLangOpts());
579579
TransformActions TA(*Diags, capturedDiags, Ctx, Unit->getPreprocessor());
580-
MigrationPass pass(Ctx, OrigCI.getLangOpts()->getGC(),
580+
MigrationPass pass(Ctx, OrigCI.getLangOpts().getGC(),
581581
Unit->getSema(), TA, capturedDiags, ARCMTMacroLocs);
582582

583583
trans(pass);

clang/lib/Frontend/ASTUnit.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ ASTUnit::getMainBufferWithPrecompiledPreamble(
13351335
return nullptr;
13361336

13371337
PreambleBounds Bounds = ComputePreambleBounds(
1338-
*PreambleInvocationIn.getLangOpts(), *MainFileBuffer, MaxLines);
1338+
PreambleInvocationIn.getLangOpts(), *MainFileBuffer, MaxLines);
13391339
if (!Bounds.Size)
13401340
return nullptr;
13411341

@@ -1799,7 +1799,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromCommandLine(
17991799
CI->getHeaderSearchOpts().ModuleFormat = std::string(*ModuleFormat);
18001800

18011801
if (ForSerialization)
1802-
CI->getLangOpts()->NeededByPCHOrCompilationUsesPCH = true;
1802+
CI->getLangOpts().NeededByPCHOrCompilationUsesPCH = true;
18031803

18041804
// Create the AST unit.
18051805
std::unique_ptr<ASTUnit> AST;
@@ -2199,7 +2199,7 @@ void ASTUnit::CodeComplete(
21992199
FrontendOpts.CodeCompletionAt.Column = Column;
22002200

22012201
// Set the language options appropriately.
2202-
LangOpts = *CCInvocation->getLangOpts();
2202+
LangOpts = CCInvocation->getLangOpts();
22032203

22042204
// Spell-checking and warnings are wasteful during code-completion.
22052205
LangOpts.SpellChecking = false;

clang/lib/Frontend/CompilerInstance.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,11 +1275,11 @@ compileModuleImpl(CompilerInstance &ImportingInstance, SourceLocation ImportLoc,
12751275
});
12761276

12771277
// If the original compiler invocation had -fmodule-name, pass it through.
1278-
Invocation->getLangOpts()->ModuleName =
1279-
ImportingInstance.getInvocation().getLangOpts()->ModuleName;
1278+
Invocation->getLangOpts().ModuleName =
1279+
ImportingInstance.getInvocation().getLangOpts().ModuleName;
12801280

12811281
// Note the name of the module we're building.
1282-
Invocation->getLangOpts()->CurrentModule = std::string(ModuleName);
1282+
Invocation->getLangOpts().CurrentModule = std::string(ModuleName);
12831283

12841284
// Make sure that the failed-module structure has been allocated in
12851285
// the importing instance, and propagate the pointer to the newly-created
@@ -2284,7 +2284,7 @@ void CompilerInstance::createModuleFromSource(SourceLocation ImportLoc,
22842284

22852285
FrontendInputFile Input(
22862286
ModuleMapFileName,
2287-
InputKind(getLanguageFromOptions(*Invocation->getLangOpts()),
2287+
InputKind(getLanguageFromOptions(Invocation->getLangOpts()),
22882288
InputKind::ModuleMap, /*Preprocessed*/true));
22892289

22902290
std::string NullTerminatedSource(Source.str());

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ CompilerInvocationRefBase::CompilerInvocationRefBase()
140140

141141
CompilerInvocationRefBase::CompilerInvocationRefBase(
142142
const CompilerInvocationRefBase &X)
143-
: LangOpts(new LangOptions(*X.getLangOpts())),
143+
: LangOpts(new LangOptions(X.getLangOpts())),
144144
TargetOpts(new TargetOptions(X.getTargetOpts())),
145145
DiagnosticOpts(new DiagnosticOptions(X.getDiagnosticOpts())),
146146
HeaderSearchOpts(new HeaderSearchOptions(X.getHeaderSearchOpts())),
@@ -490,7 +490,7 @@ static bool FixupInvocation(CompilerInvocation &Invocation,
490490
InputKind IK) {
491491
unsigned NumErrorsBefore = Diags.getNumErrors();
492492

493-
LangOptions &LangOpts = *Invocation.getLangOpts();
493+
LangOptions &LangOpts = Invocation.getLangOpts();
494494
CodeGenOptions &CodeGenOpts = Invocation.getCodeGenOpts();
495495
TargetOptions &TargetOpts = Invocation.getTargetOpts();
496496
FrontendOptions &FrontendOpts = Invocation.getFrontendOpts();
@@ -4787,7 +4787,7 @@ bool CompilerInvocation::CreateFromArgsImpl(
47874787
InputArgList Args = Opts.ParseArgs(CommandLineArgs, MissingArgIndex,
47884788
MissingArgCount, IncludedFlagsBitmask);
47894789

4790-
LangOptions &LangOpts = *Res.getLangOpts();
4790+
LangOptions &LangOpts = Res.getLangOpts();
47914791

47924792
// Check for missing argument error.
47934793
if (MissingArgCount)
@@ -4889,7 +4889,7 @@ bool CompilerInvocation::CreateFromArgsImpl(
48894889

48904890
// If sanitizer is enabled, disable OPT_ffine_grained_bitfield_accesses.
48914891
if (Res.getCodeGenOpts().FineGrainedBitfieldAccesses &&
4892-
!Res.getLangOpts()->Sanitize.empty()) {
4892+
!Res.getLangOpts().Sanitize.empty()) {
48934893
Res.getCodeGenOpts().FineGrainedBitfieldAccesses = false;
48944894
Diags.Report(diag::warn_drv_fine_grained_bitfield_accesses_ignored);
48954895
}
@@ -5039,7 +5039,7 @@ std::string CompilerInvocation::getModuleHash(DiagnosticsEngine &Diags) const {
50395039
// -Werror: consider all warnings into the hash
50405040
// -Werror=something: consider only the specified into the hash
50415041
// -pedantic-error
5042-
if (getLangOpts()->ModulesHashErrorDiags) {
5042+
if (getLangOpts().ModulesHashErrorDiags) {
50435043
bool ConsiderAllWarningsAsErrors = Diags.getWarningsAsErrors();
50445044
HBuilder.add(isExtHandlingFromDiagsError(Diags));
50455045
for (auto DiagIDMappingPair : Diags.getDiagnosticMappings()) {
@@ -5095,12 +5095,12 @@ std::vector<std::string> CompilerInvocation::getCC1CommandLine() const {
50955095
}
50965096

50975097
void CompilerInvocation::resetNonModularOptions() {
5098-
getLangOpts()->resetNonModularOptions();
5098+
getLangOpts().resetNonModularOptions();
50995099
getPreprocessorOpts().resetNonModularOptions();
51005100
}
51015101

51025102
void CompilerInvocation::clearImplicitModuleBuildOptions() {
5103-
getLangOpts()->ImplicitModules = false;
5103+
getLangOpts().ImplicitModules = false;
51045104
getHeaderSearchOpts().ImplicitModuleMaps = false;
51055105
getHeaderSearchOpts().ModuleCachePath.clear();
51065106
getHeaderSearchOpts().ModulesValidateOncePerBuildSession = false;

clang/lib/Frontend/PrecompiledPreamble.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ void PrecompiledPreamble::AddImplicitPreamble(
719719
void PrecompiledPreamble::OverridePreamble(
720720
CompilerInvocation &CI, IntrusiveRefCntPtr<llvm::vfs::FileSystem> &VFS,
721721
llvm::MemoryBuffer *MainFileBuffer) const {
722-
auto Bounds = ComputePreambleBounds(*CI.getLangOpts(), *MainFileBuffer, 0);
722+
auto Bounds = ComputePreambleBounds(CI.getLangOpts(), *MainFileBuffer, 0);
723723
configurePreamble(Bounds, CI, VFS, MainFileBuffer);
724724
}
725725

clang/lib/Tooling/DependencyScanning/IncludeTreeActionController.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ IncludeTreeBuilder::finishIncludeTree(CompilerInstance &ScanInstance,
563563
return addToFileList(FM, *FE).moveInto(Ref);
564564
};
565565

566-
for (StringRef FilePath : NewInvocation.getLangOpts()->NoSanitizeFiles) {
566+
for (StringRef FilePath : NewInvocation.getLangOpts().NoSanitizeFiles) {
567567
if (Error E = addFile(FilePath))
568568
return std::move(E);
569569
}

clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ ModuleDepCollector::makeInvocationForModuleBuildWithoutOutputs(
106106
// TODO: Figure out better way to set options to their default value.
107107
CI.getCodeGenOpts().MainFileName.clear();
108108
CI.getCodeGenOpts().DwarfDebugFlags.clear();
109-
if (!CI.getLangOpts()->ModulesCodegen) {
109+
if (!CI.getLangOpts().ModulesCodegen) {
110110
CI.getCodeGenOpts().DebugCompilationDir.clear();
111111
CI.getCodeGenOpts().CoverageCompilationDir.clear();
112112
CI.getCodeGenOpts().CoverageDataFile.clear();
@@ -127,7 +127,7 @@ ModuleDepCollector::makeInvocationForModuleBuildWithoutOutputs(
127127
CI.getFrontendOpts().ARCMTAction = FrontendOptions::ARCMT_None;
128128
CI.getFrontendOpts().ObjCMTAction = FrontendOptions::ObjCMT_None;
129129
CI.getFrontendOpts().MTMigrateDir.clear();
130-
CI.getLangOpts()->ModuleName = Deps.ID.ModuleName;
130+
CI.getLangOpts().ModuleName = Deps.ID.ModuleName;
131131
CI.getFrontendOpts().IsSystemModule = Deps.IsSystem;
132132

133133
// Inputs

clang/lib/Tooling/DependencyScanning/ScanAndUpdateArgs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ void DepscanPrefixMapping::remapInvocationPaths(CompilerInvocation &Invocation,
178178
Mapper.mapInPlace(CodeGenOpts.CoverageCompilationDir);
179179

180180
// Sanitizer options.
181-
mapInPlaceAll(Invocation.getLangOpts()->NoSanitizeFiles);
181+
mapInPlaceAll(Invocation.getLangOpts().NoSanitizeFiles);
182182

183183
// Handle coverage mappings.
184184
Mapper.mapInPlace(CodeGenOpts.ProfileInstrumentUsePath);

0 commit comments

Comments
 (0)