Author: Jan Svoboda Date: 2023-09-05T13:23:53-07:00 New Revision: 5746002ebb9c3d02be408edf13c2edc39aecf591
URL: https://github.com/llvm/llvm-project/commit/5746002ebb9c3d02be408edf13c2edc39aecf591 DIFF: https://github.com/llvm/llvm-project/commit/5746002ebb9c3d02be408edf13c2edc39aecf591.diff LOG: [clang] NFCI: Change returned LanguageOptions pointer to reference Added: Modified: clang-tools-extra/clangd/ClangdServer.cpp clang-tools-extra/clangd/CodeComplete.cpp clang-tools-extra/clangd/Compiler.cpp clang-tools-extra/clangd/ParsedAST.cpp clang-tools-extra/clangd/Preamble.cpp clang-tools-extra/clangd/index/StdLib.cpp clang-tools-extra/clangd/unittests/PreambleTests.cpp clang/include/clang/Frontend/CompilerInstance.h clang/include/clang/Frontend/CompilerInvocation.h clang/lib/ARCMigrate/ARCMT.cpp clang/lib/Frontend/ASTUnit.cpp clang/lib/Frontend/CompilerInstance.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Frontend/PrecompiledPreamble.cpp clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp clang/tools/arcmt-test/arcmt-test.cpp clang/tools/clang-import-test/clang-import-test.cpp clang/tools/libclang/Indexing.cpp clang/unittests/Frontend/CompilerInvocationTest.cpp clang/unittests/Frontend/FrontendActionTest.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp index 57a4897a85efb1c..dce6bfc04ce6dd5 100644 --- a/clang-tools-extra/clangd/ClangdServer.cpp +++ b/clang-tools-extra/clangd/ClangdServer.cpp @@ -83,7 +83,7 @@ struct UpdateIndexCallbacks : public ParsingCallbacks { auto &PP = ASTCtx.getPreprocessor(); auto &CI = ASTCtx.getCompilerInvocation(); - if (auto Loc = Stdlib->add(*CI.getLangOpts(), PP.getHeaderSearchInfo())) + if (auto Loc = Stdlib->add(CI.getLangOpts(), PP.getHeaderSearchInfo())) indexStdlib(CI, std::move(*Loc)); // FIndex outlives the UpdateIndexCallbacks. @@ -105,7 +105,7 @@ struct UpdateIndexCallbacks : public ParsingCallbacks { // This task is owned by Tasks, which outlives the TUScheduler and // therefore the UpdateIndexCallbacks. // We must be careful that the references we capture outlive TUScheduler. - auto Task = [LO(*CI.getLangOpts()), Loc(std::move(Loc)), + auto Task = [LO(CI.getLangOpts()), Loc(std::move(Loc)), CI(std::make_unique<CompilerInvocation>(CI)), // External values that outlive ClangdServer TFS(&TFS), diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp index 1a0023d4b453a1f..70c4d7e65b76db3 100644 --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -1356,11 +1356,11 @@ bool semaCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer, auto &FrontendOpts = CI->getFrontendOpts(); FrontendOpts.SkipFunctionBodies = true; // Disable typo correction in Sema. - CI->getLangOpts()->SpellChecking = false; + CI->getLangOpts().SpellChecking = false; // Code completion won't trigger in delayed template bodies. // This is on-by-default in windows to allow parsing SDK headers; we're only // disabling it for the main-file (not preamble). - CI->getLangOpts()->DelayedTemplateParsing = false; + CI->getLangOpts().DelayedTemplateParsing = false; // Setup code completion. FrontendOpts.CodeCompleteOpts = Options; FrontendOpts.CodeCompletionAt.FileName = std::string(Input.FileName); @@ -1380,7 +1380,7 @@ bool semaCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer, // overriding the preamble will break sema completion. Fortunately we can just // skip all includes in this case; these completions are really simple. PreambleBounds PreambleRegion = - ComputePreambleBounds(*CI->getLangOpts(), *ContentsBuffer, 0); + ComputePreambleBounds(CI->getLangOpts(), *ContentsBuffer, 0); bool CompletingInPreamble = Input.Offset < PreambleRegion.Size || (!PreambleRegion.PreambleEndsAtStartOfLine && Input.Offset == PreambleRegion.Size); diff --git a/clang-tools-extra/clangd/Compiler.cpp b/clang-tools-extra/clangd/Compiler.cpp index 7b93353cab1f3cd..c60ab8e1b8062a8 100644 --- a/clang-tools-extra/clangd/Compiler.cpp +++ b/clang-tools-extra/clangd/Compiler.cpp @@ -84,11 +84,11 @@ void disableUnsupportedOptions(CompilerInvocation &CI) { // These options mostly affect codegen, and aren't relevant to clangd. And // clang will die immediately when these files are not existed. // Disable these uninteresting options to make clangd more robust. - CI.getLangOpts()->NoSanitizeFiles.clear(); - CI.getLangOpts()->XRayAttrListFiles.clear(); - CI.getLangOpts()->ProfileListFiles.clear(); - CI.getLangOpts()->XRayAlwaysInstrumentFiles.clear(); - CI.getLangOpts()->XRayNeverInstrumentFiles.clear(); + CI.getLangOpts().NoSanitizeFiles.clear(); + CI.getLangOpts().XRayAttrListFiles.clear(); + CI.getLangOpts().ProfileListFiles.clear(); + CI.getLangOpts().XRayAlwaysInstrumentFiles.clear(); + CI.getLangOpts().XRayNeverInstrumentFiles.clear(); } std::unique_ptr<CompilerInvocation> @@ -118,8 +118,8 @@ buildCompilerInvocation(const ParseInputs &Inputs, clang::DiagnosticConsumer &D, return nullptr; // createInvocationFromCommandLine sets DisableFree. CI->getFrontendOpts().DisableFree = false; - CI->getLangOpts()->CommentOpts.ParseAllComments = true; - CI->getLangOpts()->RetainCommentsFromSystemHeaders = true; + CI->getLangOpts().CommentOpts.ParseAllComments = true; + CI->getLangOpts().RetainCommentsFromSystemHeaders = true; disableUnsupportedOptions(*CI); return CI; diff --git a/clang-tools-extra/clangd/ParsedAST.cpp b/clang-tools-extra/clangd/ParsedAST.cpp index 3e06a67566cf756..3f6c0eaebac6c41 100644 --- a/clang-tools-extra/clangd/ParsedAST.cpp +++ b/clang-tools-extra/clangd/ParsedAST.cpp @@ -413,7 +413,7 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs, // This is on-by-default in windows to allow parsing SDK headers, but it // breaks many features. Disable it for the main-file (not preamble). - CI->getLangOpts()->DelayedTemplateParsing = false; + CI->getLangOpts().DelayedTemplateParsing = false; std::vector<std::unique_ptr<FeatureModule::ASTListener>> ASTListeners; if (Inputs.FeatureModules) { diff --git a/clang-tools-extra/clangd/Preamble.cpp b/clang-tools-extra/clangd/Preamble.cpp index f8fd43276817050..60c0f936d6f3810 100644 --- a/clang-tools-extra/clangd/Preamble.cpp +++ b/clang-tools-extra/clangd/Preamble.cpp @@ -365,7 +365,7 @@ scanPreamble(llvm::StringRef Contents, const tooling::CompileCommand &Cmd) { // This means we're scanning (though not preprocessing) the preamble section // twice. However, it's important to precisely follow the preamble bounds used // elsewhere. - auto Bounds = ComputePreambleBounds(*CI->getLangOpts(), *ContentsBuffer, 0); + auto Bounds = ComputePreambleBounds(CI->getLangOpts(), *ContentsBuffer, 0); auto PreambleContents = llvm::MemoryBuffer::getMemBufferCopy( llvm::StringRef(PI.Contents).take_front(Bounds.Size)); auto Clang = prepareCompilerInstance( @@ -596,7 +596,7 @@ buildPreamble(PathRef FileName, CompilerInvocation CI, // without those. auto ContentsBuffer = llvm::MemoryBuffer::getMemBuffer(Inputs.Contents, FileName); - auto Bounds = ComputePreambleBounds(*CI.getLangOpts(), *ContentsBuffer, 0); + auto Bounds = ComputePreambleBounds(CI.getLangOpts(), *ContentsBuffer, 0); trace::Span Tracer("BuildPreamble"); SPAN_ATTACH(Tracer, "File", FileName); @@ -622,7 +622,7 @@ buildPreamble(PathRef FileName, CompilerInvocation CI, const clang::Diagnostic &Info) { if (Cfg.Diagnostics.SuppressAll || isBuiltinDiagnosticSuppressed(Info.getID(), Cfg.Diagnostics.Suppress, - *CI.getLangOpts())) + CI.getLangOpts())) return DiagnosticsEngine::Ignored; switch (Info.getID()) { case diag::warn_no_newline_eof: @@ -732,7 +732,7 @@ bool isPreambleCompatible(const PreambleData &Preamble, const CompilerInvocation &CI) { auto ContentsBuffer = llvm::MemoryBuffer::getMemBuffer(Inputs.Contents, FileName); - auto Bounds = ComputePreambleBounds(*CI.getLangOpts(), *ContentsBuffer, 0); + auto Bounds = ComputePreambleBounds(CI.getLangOpts(), *ContentsBuffer, 0); auto VFS = Inputs.TFS->view(Inputs.CompileCommand.Directory); return compileCommandsAreEqual(Inputs.CompileCommand, Preamble.CompileCommand) && diff --git a/clang-tools-extra/clangd/index/StdLib.cpp b/clang-tools-extra/clangd/index/StdLib.cpp index 477a5d1ebe523f2..390c2e41f6c0f97 100644 --- a/clang-tools-extra/clangd/index/StdLib.cpp +++ b/clang-tools-extra/clangd/index/StdLib.cpp @@ -207,7 +207,7 @@ SymbolSlab indexStandardLibrary(llvm::StringRef HeaderSources, } const FrontendInputFile &Input = CI->getFrontendOpts().Inputs.front(); trace::Span Tracer("StandardLibraryIndex"); - LangStandard::Kind LangStd = standardFromOpts(*CI->getLangOpts()); + LangStandard::Kind LangStd = standardFromOpts(CI->getLangOpts()); log("Indexing {0} standard library in the context of {1}", LangStandard::getLangStandardForKind(LangStd).getName(), Input.getFile()); @@ -267,7 +267,7 @@ SymbolSlab indexStandardLibrary(llvm::StringRef HeaderSources, SymbolSlab indexStandardLibrary(std::unique_ptr<CompilerInvocation> Invocation, const StdLibLocation &Loc, const ThreadsafeFS &TFS) { - llvm::StringRef Header = getStdlibUmbrellaHeader(*Invocation->getLangOpts()); + llvm::StringRef Header = getStdlibUmbrellaHeader(Invocation->getLangOpts()); return indexStandardLibrary(Header, std::move(Invocation), Loc, TFS); } diff --git a/clang-tools-extra/clangd/unittests/PreambleTests.cpp b/clang-tools-extra/clangd/unittests/PreambleTests.cpp index 03dfa2eaa338636..6da98c55e392706 100644 --- a/clang-tools-extra/clangd/unittests/PreambleTests.cpp +++ b/clang-tools-extra/clangd/unittests/PreambleTests.cpp @@ -88,7 +88,7 @@ collectPatchedIncludes(llvm::StringRef ModifiedContents, // introduced by the patch is parsed and nothing else. // We don't run PP directly over the patch cotents to test production // behaviour. - auto Bounds = Lexer::ComputePreamble(ModifiedContents, *CI->getLangOpts()); + auto Bounds = Lexer::ComputePreamble(ModifiedContents, CI->getLangOpts()); auto Clang = prepareCompilerInstance(std::move(CI), &BaselinePreamble->Preamble, llvm::MemoryBuffer::getMemBufferCopy( @@ -588,7 +588,7 @@ TEST(PreamblePatch, ModifiedBounds) { ASSERT_TRUE(CI); const auto ExpectedBounds = - Lexer::ComputePreamble(Case.Modified, *CI->getLangOpts()); + Lexer::ComputePreamble(Case.Modified, CI->getLangOpts()); EXPECT_EQ(PP.modifiedBounds().Size, ExpectedBounds.Size); EXPECT_EQ(PP.modifiedBounds().PreambleEndsAtStartOfLine, ExpectedBounds.PreambleEndsAtStartOfLine); diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h index 377055e8f6f9246..44ba3f83695e7e3 100644 --- a/clang/include/clang/Frontend/CompilerInstance.h +++ b/clang/include/clang/Frontend/CompilerInstance.h @@ -301,12 +301,8 @@ class CompilerInstance : public ModuleLoader { return Invocation->getHeaderSearchOptsPtr(); } - LangOptions &getLangOpts() { - return *Invocation->getLangOpts(); - } - const LangOptions &getLangOpts() const { - return *Invocation->getLangOpts(); - } + LangOptions &getLangOpts() { return Invocation->getLangOpts(); } + const LangOptions &getLangOpts() const { return Invocation->getLangOpts(); } PreprocessorOptions &getPreprocessorOpts() { return Invocation->getPreprocessorOpts(); diff --git a/clang/include/clang/Frontend/CompilerInvocation.h b/clang/include/clang/Frontend/CompilerInvocation.h index 4142499f2dd703e..8b43edf7b932695 100644 --- a/clang/include/clang/Frontend/CompilerInvocation.h +++ b/clang/include/clang/Frontend/CompilerInvocation.h @@ -101,8 +101,8 @@ class CompilerInvocationRefBase { CompilerInvocationRefBase &operator=(CompilerInvocationRefBase &&X); ~CompilerInvocationRefBase(); - LangOptions *getLangOpts() { return LangOpts.get(); } - const LangOptions *getLangOpts() const { return LangOpts.get(); } + LangOptions &getLangOpts() { return *LangOpts; } + const LangOptions &getLangOpts() const { return *LangOpts; } TargetOptions &getTargetOpts() { return *TargetOpts.get(); } const TargetOptions &getTargetOpts() const { return *TargetOpts.get(); } diff --git a/clang/lib/ARCMigrate/ARCMT.cpp b/clang/lib/ARCMigrate/ARCMT.cpp index ac79f3f03e6b27d..ea0f25a6891166f 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 98d6c08146d6c80..a4753f525d9de2d 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 0bbfb2a81acae6e..e500675866eb324 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 4b821d15ed18524..e9e2445c879ce0f 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 5ffb54e2fdf6578..b768c53198a05a0 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 cadb1865731b040..e13f7c74e9b92e2 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 diff --git a/clang/tools/arcmt-test/arcmt-test.cpp b/clang/tools/arcmt-test/arcmt-test.cpp index 26e123c59d59daa..53229ac570bc188 100644 --- a/clang/tools/arcmt-test/arcmt-test.cpp +++ b/clang/tools/arcmt-test/arcmt-test.cpp @@ -129,7 +129,7 @@ static bool checkForMigration(StringRef resourcesPath, return true; } - if (!CI.getLangOpts()->ObjC) + if (!CI.getLangOpts().ObjC) return false; arcmt::checkForManualIssues(CI, CI.getFrontendOpts().Inputs[0], @@ -167,14 +167,14 @@ static bool performTransformations(StringRef resourcesPath, return true; } - if (!origCI.getLangOpts()->ObjC) + if (!origCI.getLangOpts().ObjC) return false; MigrationProcess migration(origCI, std::make_shared<PCHContainerOperations>(), DiagClient); std::vector<TransformFn> - transforms = arcmt::getAllTransformations(origCI.getLangOpts()->getGC(), + transforms = arcmt::getAllTransformations(origCI.getLangOpts().getGC(), origCI.getMigratorOpts().NoFinalizeRemoval); assert(!transforms.empty()); diff --git a/clang/tools/clang-import-test/clang-import-test.cpp b/clang/tools/clang-import-test/clang-import-test.cpp index b5e2a7447aece71..2473e16a546dc0b 100644 --- a/clang/tools/clang-import-test/clang-import-test.cpp +++ b/clang/tools/clang-import-test/clang-import-test.cpp @@ -178,28 +178,28 @@ std::unique_ptr<CompilerInstance> BuildCompilerInstance() { ID Id = lookupTypeForTypeSpecifier(Input.c_str()); assert(Id != TY_INVALID); if (isCXX(Id)) { - Inv->getLangOpts()->CPlusPlus = true; - Inv->getLangOpts()->CPlusPlus11 = true; + Inv->getLangOpts().CPlusPlus = true; + Inv->getLangOpts().CPlusPlus11 = true; Inv->getHeaderSearchOpts().UseLibcxx = true; } if (isObjC(Id)) { - Inv->getLangOpts()->ObjC = 1; + Inv->getLangOpts().ObjC = 1; } } - Inv->getLangOpts()->ObjCAutoRefCount = ObjCARC; - - Inv->getLangOpts()->Bool = true; - Inv->getLangOpts()->WChar = true; - Inv->getLangOpts()->Blocks = true; - Inv->getLangOpts()->DebuggerSupport = true; - Inv->getLangOpts()->SpellChecking = false; - Inv->getLangOpts()->ThreadsafeStatics = false; - Inv->getLangOpts()->AccessControl = false; - Inv->getLangOpts()->DollarIdents = true; - Inv->getLangOpts()->Exceptions = true; - Inv->getLangOpts()->CXXExceptions = true; + Inv->getLangOpts().ObjCAutoRefCount = ObjCARC; + + Inv->getLangOpts().Bool = true; + Inv->getLangOpts().WChar = true; + Inv->getLangOpts().Blocks = true; + Inv->getLangOpts().DebuggerSupport = true; + Inv->getLangOpts().SpellChecking = false; + Inv->getLangOpts().ThreadsafeStatics = false; + Inv->getLangOpts().AccessControl = false; + Inv->getLangOpts().DollarIdents = true; + Inv->getLangOpts().Exceptions = true; + Inv->getLangOpts().CXXExceptions = true; // Needed for testing dynamic_cast. - Inv->getLangOpts()->RTTI = true; + Inv->getLangOpts().RTTI = true; Inv->getCodeGenOpts().setDebugInfo(llvm::codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); diff --git a/clang/tools/libclang/Indexing.cpp b/clang/tools/libclang/Indexing.cpp index 5fdc3de0d2bfa5e..9288cabfaae6964 100644 --- a/clang/tools/libclang/Indexing.cpp +++ b/clang/tools/libclang/Indexing.cpp @@ -546,7 +546,7 @@ static CXErrorCode clang_indexSourceFile_Impl( // (often very broken) source code, where spell-checking can have a // significant negative impact on performance (particularly when // precompiled headers are involved), we disable it. - CInvok->getLangOpts()->SpellChecking = false; + CInvok->getLangOpts().SpellChecking = false; if (index_options & CXIndexOpt_SuppressWarnings) CInvok->getDiagnosticOpts().IgnoreWarnings = true; @@ -571,7 +571,7 @@ static CXErrorCode clang_indexSourceFile_Impl( // Enable the skip-parsed-bodies optimization only for C++; this may be // revisited. bool SkipBodies = (index_options & CXIndexOpt_SkipParsedBodiesInSession) && - CInvok->getLangOpts()->CPlusPlus; + CInvok->getLangOpts().CPlusPlus; if (SkipBodies) CInvok->getFrontendOpts().SkipFunctionBodies = true; @@ -608,7 +608,7 @@ static CXErrorCode clang_indexSourceFile_Impl( PPOpts.DetailedRecord = true; } - if (!requestedToGetTU && !CInvok->getLangOpts()->Modules) + if (!requestedToGetTU && !CInvok->getLangOpts().Modules) PPOpts.DetailedRecord = false; // Unless the user specified that they want the preamble on the first parse diff --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp b/clang/unittests/Frontend/CompilerInvocationTest.cpp index 798b61693639bd5..673b34dc088fa7f 100644 --- a/clang/unittests/Frontend/CompilerInvocationTest.cpp +++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp @@ -506,7 +506,7 @@ TEST_F(CommandLineTest, StringVectorCommaJoinedNone) { const char *Args[] = {""}; ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); - ASSERT_TRUE(Invocation.getLangOpts()->CommentOpts.BlockCommandNames.empty()); + ASSERT_TRUE(Invocation.getLangOpts().CommentOpts.BlockCommandNames.empty()); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -518,7 +518,7 @@ TEST_F(CommandLineTest, StringVectorCommaJoinedSingle) { const char *Args[] = {"-fcomment-block-commands=x,y"}; ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); - ASSERT_EQ(Invocation.getLangOpts()->CommentOpts.BlockCommandNames, + ASSERT_EQ(Invocation.getLangOpts().CommentOpts.BlockCommandNames, std::vector<std::string>({"x", "y"})); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -532,7 +532,7 @@ TEST_F(CommandLineTest, StringVectorCommaJoinedMultiple) { "-fcomment-block-commands=a,b"}; ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); - ASSERT_EQ(Invocation.getLangOpts()->CommentOpts.BlockCommandNames, + ASSERT_EQ(Invocation.getLangOpts().CommentOpts.BlockCommandNames, std::vector<std::string>({"x", "y", "a", "b"})); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -549,9 +549,9 @@ TEST_F(CommandLineTest, ConditionalParsingIfFalseFlagNotPresent) { CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags); ASSERT_FALSE(Diags->hasErrorOccurred()); - ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsDevice); - ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsHost); - ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_None); + ASSERT_FALSE(Invocation.getLangOpts().SYCLIsDevice); + ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost); + ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_None); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -565,9 +565,9 @@ TEST_F(CommandLineTest, ConditionalParsingIfFalseFlagPresent) { CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags); ASSERT_FALSE(Diags->hasErrorOccurred()); - ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsDevice); - ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsHost); - ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_None); + ASSERT_FALSE(Invocation.getLangOpts().SYCLIsDevice); + ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost); + ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_None); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -582,9 +582,9 @@ TEST_F(CommandLineTest, ConditionalParsingIfNonsenseSyclStdArg) { CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags); ASSERT_TRUE(Diags->hasErrorOccurred()); - ASSERT_TRUE(Invocation.getLangOpts()->SYCLIsDevice); - ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsHost); - ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_None); + ASSERT_TRUE(Invocation.getLangOpts().SYCLIsDevice); + ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost); + ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_None); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -599,9 +599,9 @@ TEST_F(CommandLineTest, ConditionalParsingIfOddSyclStdArg1) { CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags); ASSERT_FALSE(Diags->hasErrorOccurred()); - ASSERT_TRUE(Invocation.getLangOpts()->SYCLIsDevice); - ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsHost); - ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_2017); + ASSERT_TRUE(Invocation.getLangOpts().SYCLIsDevice); + ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost); + ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -616,9 +616,9 @@ TEST_F(CommandLineTest, ConditionalParsingIfOddSyclStdArg2) { CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags); ASSERT_FALSE(Diags->hasErrorOccurred()); - ASSERT_TRUE(Invocation.getLangOpts()->SYCLIsDevice); - ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsHost); - ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_2017); + ASSERT_TRUE(Invocation.getLangOpts().SYCLIsDevice); + ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost); + ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -633,9 +633,9 @@ TEST_F(CommandLineTest, ConditionalParsingIfOddSyclStdArg3) { CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags); ASSERT_FALSE(Diags->hasErrorOccurred()); - ASSERT_TRUE(Invocation.getLangOpts()->SYCLIsDevice); - ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsHost); - ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_2017); + ASSERT_TRUE(Invocation.getLangOpts().SYCLIsDevice); + ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost); + ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -650,7 +650,7 @@ TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagNotPresentHost) { CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags); ASSERT_FALSE(Diags->hasErrorOccurred()); - ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), + ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_Default); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -665,7 +665,7 @@ TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagNotPresentDevice) { CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags); ASSERT_FALSE(Diags->hasErrorOccurred()); - ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), + ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_Default); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -680,7 +680,7 @@ TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagPresent) { CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags); ASSERT_FALSE(Diags->hasErrorOccurred()); - ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_2017); + ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -712,10 +712,10 @@ TEST_F(CommandLineTest, ImpliedBoolOptionsNoFlagPresent) { const char *Args[] = {""}; ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); - ASSERT_FALSE(Invocation.getLangOpts()->CLUnsafeMath); + ASSERT_FALSE(Invocation.getLangOpts().CLUnsafeMath); ASSERT_FALSE(Invocation.getCodeGenOpts().LessPreciseFPMAD); - ASSERT_FALSE(Invocation.getLangOpts()->UnsafeFPMath); - ASSERT_FALSE(Invocation.getLangOpts()->AllowRecip); + ASSERT_FALSE(Invocation.getLangOpts().UnsafeFPMath); + ASSERT_FALSE(Invocation.getLangOpts().AllowRecip); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -733,12 +733,12 @@ TEST_F(CommandLineTest, ImpliedBoolOptionsRootFlagPresent) { ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); // Explicitly provided root flag. - ASSERT_TRUE(Invocation.getLangOpts()->CLUnsafeMath); + ASSERT_TRUE(Invocation.getLangOpts().CLUnsafeMath); // Directly implied by explicitly provided root flag. ASSERT_TRUE(Invocation.getCodeGenOpts().LessPreciseFPMAD); - ASSERT_TRUE(Invocation.getLangOpts()->UnsafeFPMath); + ASSERT_TRUE(Invocation.getLangOpts().UnsafeFPMath); // Transitively implied by explicitly provided root flag. - ASSERT_TRUE(Invocation.getLangOpts()->AllowRecip); + ASSERT_TRUE(Invocation.getLangOpts().AllowRecip); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -756,10 +756,10 @@ TEST_F(CommandLineTest, ImpliedBoolOptionsAllFlagsPresent) { "-funsafe-math-optimizations", "-freciprocal-math"}; ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); - ASSERT_TRUE(Invocation.getLangOpts()->CLUnsafeMath); + ASSERT_TRUE(Invocation.getLangOpts().CLUnsafeMath); ASSERT_TRUE(Invocation.getCodeGenOpts().LessPreciseFPMAD); - ASSERT_TRUE(Invocation.getLangOpts()->UnsafeFPMath); - ASSERT_TRUE(Invocation.getLangOpts()->AllowRecip); + ASSERT_TRUE(Invocation.getLangOpts().UnsafeFPMath); + ASSERT_TRUE(Invocation.getLangOpts().AllowRecip); Invocation.generateCC1CommandLine(GeneratedArgs, *this); @@ -777,10 +777,10 @@ TEST_F(CommandLineTest, ImpliedBoolOptionsImpliedFlagsPresent) { "-freciprocal-math"}; ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); - ASSERT_FALSE(Invocation.getLangOpts()->CLUnsafeMath); + ASSERT_FALSE(Invocation.getLangOpts().CLUnsafeMath); ASSERT_TRUE(Invocation.getCodeGenOpts().LessPreciseFPMAD); - ASSERT_TRUE(Invocation.getLangOpts()->UnsafeFPMath); - ASSERT_TRUE(Invocation.getLangOpts()->AllowRecip); + ASSERT_TRUE(Invocation.getLangOpts().UnsafeFPMath); + ASSERT_TRUE(Invocation.getLangOpts().AllowRecip); Invocation.generateCC1CommandLine(GeneratedArgs, *this); // Not generated - missing. @@ -826,7 +826,7 @@ TEST_F(CommandLineTest, DigraphsImplied) { const char *Args[] = {""}; ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); - ASSERT_TRUE(Invocation.getLangOpts()->Digraphs); + ASSERT_TRUE(Invocation.getLangOpts().Digraphs); Invocation.generateCC1CommandLine(GeneratedArgs, *this); ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fno-digraphs")))); @@ -837,7 +837,7 @@ TEST_F(CommandLineTest, DigraphsDisabled) { const char *Args[] = {"-fno-digraphs"}; ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); - ASSERT_FALSE(Invocation.getLangOpts()->Digraphs); + ASSERT_FALSE(Invocation.getLangOpts().Digraphs); Invocation.generateCC1CommandLine(GeneratedArgs, *this); ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fno-digraphs"))); @@ -848,7 +848,7 @@ TEST_F(CommandLineTest, DigraphsNotImplied) { const char *Args[] = {"-std=c89"}; ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); - ASSERT_FALSE(Invocation.getLangOpts()->Digraphs); + ASSERT_FALSE(Invocation.getLangOpts().Digraphs); Invocation.generateCC1CommandLine(GeneratedArgs, *this); ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fno-digraphs")))); @@ -859,7 +859,7 @@ TEST_F(CommandLineTest, DigraphsEnabled) { const char *Args[] = {"-std=c89", "-fdigraphs"}; ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); - ASSERT_TRUE(Invocation.getLangOpts()->Digraphs); + ASSERT_TRUE(Invocation.getLangOpts().Digraphs); Invocation.generateCC1CommandLine(GeneratedArgs, *this); ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fdigraphs"))); @@ -964,8 +964,8 @@ TEST_F(CommandLineTest, RoundTrip) { ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); - ASSERT_TRUE(Invocation.getLangOpts()->C17); - ASSERT_EQ(Invocation.getLangOpts()->MaxTokens, 10u); + ASSERT_TRUE(Invocation.getLangOpts().C17); + ASSERT_EQ(Invocation.getLangOpts().MaxTokens, 10u); ASSERT_EQ(Invocation.getTargetOpts().SDKVersion, llvm::VersionTuple(1, 2, 3)); ASSERT_EQ(Invocation.getTargetOpts().EABIVersion, EABI::EABI4); diff --git a/clang/unittests/Frontend/FrontendActionTest.cpp b/clang/unittests/Frontend/FrontendActionTest.cpp index e09b7d7886064e3..818e8cef27e51bc 100644 --- a/clang/unittests/Frontend/FrontendActionTest.cpp +++ b/clang/unittests/Frontend/FrontendActionTest.cpp @@ -121,8 +121,8 @@ TEST(ASTFrontendAction, IncrementalParsing) { TEST(ASTFrontendAction, LateTemplateIncrementalParsing) { auto invocation = std::make_shared<CompilerInvocation>(); - invocation->getLangOpts()->CPlusPlus = true; - invocation->getLangOpts()->DelayedTemplateParsing = true; + invocation->getLangOpts().CPlusPlus = true; + invocation->getLangOpts().DelayedTemplateParsing = true; invocation->getPreprocessorOpts().addRemappedFile( "test.cc", MemoryBuffer::getMemBuffer( "template<typename T> struct A { A(T); T data; };\n" @@ -233,7 +233,7 @@ struct TypoDiagnosticConsumer : public DiagnosticConsumer { TEST(ASTFrontendAction, ExternalSemaSource) { auto Invocation = std::make_shared<CompilerInvocation>(); - Invocation->getLangOpts()->CPlusPlus = true; + Invocation->getLangOpts().CPlusPlus = true; Invocation->getPreprocessorOpts().addRemappedFile( "test.cc", MemoryBuffer::getMemBuffer("void fooo();\n" "int main() { foo(); }") @@ -266,7 +266,7 @@ TEST(GeneratePCHFrontendAction, CacheGeneratedPCH) { for (bool ShouldCache : {false, true}) { auto Invocation = std::make_shared<CompilerInvocation>(); - Invocation->getLangOpts()->CacheGeneratedPCH = ShouldCache; + Invocation->getLangOpts().CacheGeneratedPCH = ShouldCache; Invocation->getPreprocessorOpts().addRemappedFile( "test.h", MemoryBuffer::getMemBuffer("int foo(void) { return 1; }\n").release()); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits