From 3d97a9beb9466a34fa3624f2eb11b9f1bc283dd0 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Sat, 4 Feb 2012 01:36:04 +0000 Subject: [PATCH] Use variable in place of multiple CI.getFrontendOpts() calls and use a bit of ArrayRef goodness. No functionality change. llvm-svn: 149739 --- clang/include/clang/Frontend/FrontendActions.h | 3 +-- clang/lib/Frontend/ASTMerge.cpp | 4 ++-- .../FrontendTool/ExecuteCompilerInvocation.cpp | 17 +++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/clang/include/clang/Frontend/FrontendActions.h b/clang/include/clang/Frontend/FrontendActions.h index c41d40c8b6df..8f7fe87ee67d 100644 --- a/clang/include/clang/Frontend/FrontendActions.h +++ b/clang/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/clang/lib/Frontend/ASTMerge.cpp b/clang/lib/Frontend/ASTMerge.cpp index a4104115f20a..d33e0ea2cdfe 100644 --- a/clang/lib/Frontend/ASTMerge.cpp +++ b/clang/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/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp index 9f2bdf25be5e..cfb185ec524b 100644 --- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/clang/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; }