diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2023-08-31 13:44:31 -0700 |
---|---|---|
committer | Jan Svoboda <jan_svoboda@apple.com> | 2023-09-05 13:23:53 -0700 |
commit | 5746002ebb9c3d02be408edf13c2edc39aecf591 (patch) | |
tree | ba7475fabaf14d59464135814c4c4af863ff70b3 /clang/lib | |
parent | b0cbf3a0dac51d426dd38c307f745e74f409aed7 (diff) | |
download | llvm-5746002ebb9c3d02be408edf13c2edc39aecf591.zip llvm-5746002ebb9c3d02be408edf13c2edc39aecf591.tar.gz llvm-5746002ebb9c3d02be408edf13c2edc39aecf591.tar.bz2 |
[clang] NFCI: Change returned LanguageOptions pointer to reference
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/ARCMigrate/ARCMT.cpp | 20 | ||||
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 12 | ||||
-rw-r--r-- | clang/lib/Frontend/PrecompiledPreamble.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp | 4 |
6 files changed, 25 insertions, 25 deletions
diff --git a/clang/lib/ARCMigrate/ARCMT.cpp b/clang/lib/ARCMigrate/ARCMT.cpp index ac79f3f..ea0f25a 100644 --- a/clang/lib/ARCMigrate/ARCMT.cpp +++ b/clang/lib/ARCMigrate/ARCMT.cpp @@ -191,8 +191,8 @@ createInvocationForMigration(CompilerInvocation &origCI, std::string define = std::string(getARCMTMacroName()); define += '='; CInvok->getPreprocessorOpts().addMacroDef(define); - CInvok->getLangOpts()->ObjCAutoRefCount = true; - CInvok->getLangOpts()->setGC(LangOptions::NonGC); + CInvok->getLangOpts().ObjCAutoRefCount = true; + CInvok->getLangOpts().setGC(LangOptions::NonGC); CInvok->getDiagnosticOpts().ErrorLimit = 0; CInvok->getDiagnosticOpts().PedanticErrors = 0; @@ -207,8 +207,8 @@ createInvocationForMigration(CompilerInvocation &origCI, WarnOpts.push_back("error=arc-unsafe-retained-assign"); CInvok->getDiagnosticOpts().Warnings = std::move(WarnOpts); - CInvok->getLangOpts()->ObjCWeakRuntime = HasARCRuntime(origCI); - CInvok->getLangOpts()->ObjCWeak = CInvok->getLangOpts()->ObjCWeakRuntime; + CInvok->getLangOpts().ObjCWeakRuntime = HasARCRuntime(origCI); + CInvok->getLangOpts().ObjCWeak = CInvok->getLangOpts().ObjCWeakRuntime; return CInvok.release(); } @@ -237,10 +237,10 @@ bool arcmt::checkForManualIssues( std::shared_ptr<PCHContainerOperations> PCHContainerOps, DiagnosticConsumer *DiagClient, bool emitPremigrationARCErrors, StringRef plistOut) { - if (!origCI.getLangOpts()->ObjC) + if (!origCI.getLangOpts().ObjC) return false; - LangOptions::GCMode OrigGCMode = origCI.getLangOpts()->getGC(); + LangOptions::GCMode OrigGCMode = origCI.getLangOpts().getGC(); bool NoNSAllocReallocError = origCI.getMigratorOpts().NoNSAllocReallocError; bool NoFinalizeRemoval = origCI.getMigratorOpts().NoFinalizeRemoval; @@ -338,10 +338,10 @@ applyTransforms(CompilerInvocation &origCI, const FrontendInputFile &Input, std::shared_ptr<PCHContainerOperations> PCHContainerOps, DiagnosticConsumer *DiagClient, StringRef outputDir, bool emitPremigrationARCErrors, StringRef plistOut) { - if (!origCI.getLangOpts()->ObjC) + if (!origCI.getLangOpts().ObjC) return false; - LangOptions::GCMode OrigGCMode = origCI.getLangOpts()->getGC(); + LangOptions::GCMode OrigGCMode = origCI.getLangOpts().getGC(); // Make sure checking is successful first. CompilerInvocation CInvokForCheck(origCI); @@ -372,7 +372,7 @@ applyTransforms(CompilerInvocation &origCI, const FrontendInputFile &Input, DiagClient, /*ShouldOwnClient=*/false)); if (outputDir.empty()) { - origCI.getLangOpts()->ObjCAutoRefCount = true; + origCI.getLangOpts().ObjCAutoRefCount = true; return migration.getRemapper().overwriteOriginal(*Diags); } else { return migration.getRemapper().flushToDisk(outputDir, *Diags); @@ -577,7 +577,7 @@ bool MigrationProcess::applyTransform(TransformFn trans, Rewriter rewriter(Ctx.getSourceManager(), Ctx.getLangOpts()); TransformActions TA(*Diags, capturedDiags, Ctx, Unit->getPreprocessor()); - MigrationPass pass(Ctx, OrigCI.getLangOpts()->getGC(), + MigrationPass pass(Ctx, OrigCI.getLangOpts().getGC(), Unit->getSema(), TA, capturedDiags, ARCMTMacroLocs); trans(pass); diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 98d6c08..a4753f52 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -1335,7 +1335,7 @@ ASTUnit::getMainBufferWithPrecompiledPreamble( return nullptr; PreambleBounds Bounds = ComputePreambleBounds( - *PreambleInvocationIn.getLangOpts(), *MainFileBuffer, MaxLines); + PreambleInvocationIn.getLangOpts(), *MainFileBuffer, MaxLines); if (!Bounds.Size) return nullptr; @@ -2198,7 +2198,7 @@ void ASTUnit::CodeComplete( FrontendOpts.CodeCompletionAt.Column = Column; // Set the language options appropriately. - LangOpts = *CCInvocation->getLangOpts(); + LangOpts = CCInvocation->getLangOpts(); // Spell-checking and warnings are wasteful during code-completion. LangOpts.SpellChecking = false; diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 0bbfb2a..e500675 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -1185,11 +1185,11 @@ compileModuleImpl(CompilerInstance &ImportingInstance, SourceLocation ImportLoc, }); // If the original compiler invocation had -fmodule-name, pass it through. - Invocation->getLangOpts()->ModuleName = - ImportingInstance.getInvocation().getLangOpts()->ModuleName; + Invocation->getLangOpts().ModuleName = + ImportingInstance.getInvocation().getLangOpts().ModuleName; // Note the name of the module we're building. - Invocation->getLangOpts()->CurrentModule = std::string(ModuleName); + Invocation->getLangOpts().CurrentModule = std::string(ModuleName); // Make sure that the failed-module structure has been allocated in // the importing instance, and propagate the pointer to the newly-created @@ -2175,7 +2175,7 @@ void CompilerInstance::createModuleFromSource(SourceLocation ImportLoc, FrontendInputFile Input( ModuleMapFileName, - InputKind(getLanguageFromOptions(*Invocation->getLangOpts()), + InputKind(getLanguageFromOptions(Invocation->getLangOpts()), InputKind::ModuleMap, /*Preprocessed*/true)); std::string NullTerminatedSource(Source.str()); diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 4b821d1..e9e2445 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -135,7 +135,7 @@ CompilerInvocationRefBase::CompilerInvocationRefBase() CompilerInvocationRefBase::CompilerInvocationRefBase( const CompilerInvocationRefBase &X) - : LangOpts(new LangOptions(*X.getLangOpts())), + : LangOpts(new LangOptions(X.getLangOpts())), TargetOpts(new TargetOptions(X.getTargetOpts())), DiagnosticOpts(new DiagnosticOptions(X.getDiagnosticOpts())), HeaderSearchOpts(new HeaderSearchOptions(X.getHeaderSearchOpts())), @@ -461,7 +461,7 @@ static bool FixupInvocation(CompilerInvocation &Invocation, InputKind IK) { unsigned NumErrorsBefore = Diags.getNumErrors(); - LangOptions &LangOpts = *Invocation.getLangOpts(); + LangOptions &LangOpts = Invocation.getLangOpts(); CodeGenOptions &CodeGenOpts = Invocation.getCodeGenOpts(); TargetOptions &TargetOpts = Invocation.getTargetOpts(); FrontendOptions &FrontendOpts = Invocation.getFrontendOpts(); @@ -4365,7 +4365,7 @@ bool CompilerInvocation::CreateFromArgsImpl( unsigned MissingArgIndex, MissingArgCount; InputArgList Args = Opts.ParseArgs(CommandLineArgs, MissingArgIndex, MissingArgCount, VisibilityMask); - LangOptions &LangOpts = *Res.getLangOpts(); + LangOptions &LangOpts = Res.getLangOpts(); // Check for missing argument error. if (MissingArgCount) @@ -4446,7 +4446,7 @@ bool CompilerInvocation::CreateFromArgsImpl( // If sanitizer is enabled, disable OPT_ffine_grained_bitfield_accesses. if (Res.getCodeGenOpts().FineGrainedBitfieldAccesses && - !Res.getLangOpts()->Sanitize.empty()) { + !Res.getLangOpts().Sanitize.empty()) { Res.getCodeGenOpts().FineGrainedBitfieldAccesses = false; Diags.Report(diag::warn_drv_fine_grained_bitfield_accesses_ignored); } @@ -4617,12 +4617,12 @@ std::vector<std::string> CompilerInvocation::getCC1CommandLine() const { } void CompilerInvocation::resetNonModularOptions() { - getLangOpts()->resetNonModularOptions(); + getLangOpts().resetNonModularOptions(); getPreprocessorOpts().resetNonModularOptions(); } void CompilerInvocation::clearImplicitModuleBuildOptions() { - getLangOpts()->ImplicitModules = false; + getLangOpts().ImplicitModules = false; getHeaderSearchOpts().ImplicitModuleMaps = false; getHeaderSearchOpts().ModuleCachePath.clear(); getHeaderSearchOpts().ModulesValidateOncePerBuildSession = false; diff --git a/clang/lib/Frontend/PrecompiledPreamble.cpp b/clang/lib/Frontend/PrecompiledPreamble.cpp index 5ffb54e..b768c53 100644 --- a/clang/lib/Frontend/PrecompiledPreamble.cpp +++ b/clang/lib/Frontend/PrecompiledPreamble.cpp @@ -719,7 +719,7 @@ void PrecompiledPreamble::AddImplicitPreamble( void PrecompiledPreamble::OverridePreamble( CompilerInvocation &CI, IntrusiveRefCntPtr<llvm::vfs::FileSystem> &VFS, llvm::MemoryBuffer *MainFileBuffer) const { - auto Bounds = ComputePreambleBounds(*CI.getLangOpts(), *MainFileBuffer, 0); + auto Bounds = ComputePreambleBounds(CI.getLangOpts(), *MainFileBuffer, 0); configurePreamble(Bounds, CI, VFS, MainFileBuffer); } diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp index cadb186..e13f7c7 100644 --- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp +++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp @@ -98,7 +98,7 @@ ModuleDepCollector::makeInvocationForModuleBuildWithoutOutputs( // TODO: Figure out better way to set options to their default value. CI.getCodeGenOpts().MainFileName.clear(); CI.getCodeGenOpts().DwarfDebugFlags.clear(); - if (!CI.getLangOpts()->ModulesCodegen) { + if (!CI.getLangOpts().ModulesCodegen) { CI.getCodeGenOpts().DebugCompilationDir.clear(); CI.getCodeGenOpts().CoverageCompilationDir.clear(); CI.getCodeGenOpts().CoverageDataFile.clear(); @@ -117,7 +117,7 @@ ModuleDepCollector::makeInvocationForModuleBuildWithoutOutputs( CI.getFrontendOpts().ARCMTAction = FrontendOptions::ARCMT_None; CI.getFrontendOpts().ObjCMTAction = FrontendOptions::ObjCMT_None; CI.getFrontendOpts().MTMigrateDir.clear(); - CI.getLangOpts()->ModuleName = Deps.ID.ModuleName; + CI.getLangOpts().ModuleName = Deps.ID.ModuleName; CI.getFrontendOpts().IsSystemModule = Deps.IsSystem; // Inputs |