From: Argyrios Kyrtzidis Date: Sat, 4 Feb 2012 01:36:04 +0000 (+0000) Subject: Use variable in place of multiple CI.getFrontendOpts() calls and use a bit X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3ca2637a9a3aeac5c7103eb4d612528680e7e20;p=clang Use variable in place of multiple CI.getFrontendOpts() calls and use a bit of ArrayRef goodness. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149739 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h index c41d40c8b6..8f7fe87ee6 100644 --- a/include/clang/Frontend/FrontendActions.h +++ b/include/clang/Frontend/FrontendActions.h @@ -153,8 +153,7 @@ protected: virtual void EndSourceFileAction(); public: - ASTMergeAction(FrontendAction *AdaptedAction, - std::string *ASTFiles, unsigned NumASTFiles); + ASTMergeAction(FrontendAction *AdaptedAction, ArrayRef ASTFiles); virtual ~ASTMergeAction(); virtual bool usesPreprocessorOnly() const; diff --git a/lib/Frontend/ASTMerge.cpp b/lib/Frontend/ASTMerge.cpp index a4104115f2..d33e0ea2cd 100644 --- a/lib/Frontend/ASTMerge.cpp +++ b/lib/Frontend/ASTMerge.cpp @@ -79,8 +79,8 @@ void ASTMergeAction::EndSourceFileAction() { } ASTMergeAction::ASTMergeAction(FrontendAction *AdaptedAction, - std::string *ASTFiles, unsigned NumASTFiles) - : AdaptedAction(AdaptedAction), ASTFiles(ASTFiles, ASTFiles + NumASTFiles) { + ArrayRef ASTFiles) + : AdaptedAction(AdaptedAction), ASTFiles(ASTFiles.begin(), ASTFiles.end()) { assert(AdaptedAction && "ASTMergeAction needs an action to adapt"); } diff --git a/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/lib/FrontendTool/ExecuteCompilerInvocation.cpp index 9f2bdf25be..cfb185ec52 100644 --- a/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -87,12 +87,14 @@ static FrontendAction *CreateFrontendAction(CompilerInstance &CI) { if (!Act) return 0; - if (CI.getFrontendOpts().FixAndRecompile) { + const FrontendOptions &FEOpts = CI.getFrontendOpts(); + + if (FEOpts.FixAndRecompile) { Act = new FixItRecompile(Act); } // Potentially wrap the base FE action in an ARC Migrate Tool action. - switch (CI.getFrontendOpts().ARCMTAction) { + switch (FEOpts.ARCMTAction) { case FrontendOptions::ARCMT_None: break; case FrontendOptions::ARCMT_Check: @@ -103,17 +105,16 @@ static FrontendAction *CreateFrontendAction(CompilerInstance &CI) { break; case FrontendOptions::ARCMT_Migrate: Act = new arcmt::MigrateAction(Act, - CI.getFrontendOpts().ARCMTMigrateDir, - CI.getFrontendOpts().ARCMTMigrateReportOut, - CI.getFrontendOpts().ARCMTMigrateEmitARCErrors); + FEOpts.ARCMTMigrateDir, + FEOpts.ARCMTMigrateReportOut, + FEOpts.ARCMTMigrateEmitARCErrors); break; } // If there are any AST files to merge, create a frontend action // adaptor to perform the merge. - if (!CI.getFrontendOpts().ASTMergeFiles.empty()) - Act = new ASTMergeAction(Act, &CI.getFrontendOpts().ASTMergeFiles[0], - CI.getFrontendOpts().ASTMergeFiles.size()); + if (!FEOpts.ASTMergeFiles.empty()) + Act = new ASTMergeAction(Act, FEOpts.ASTMergeFiles[0]); return Act; }