Use variable in place of multiple CI.getFrontendOpts() calls and use a bit

of ArrayRef goodness. No functionality change.

llvm-svn: 149739
This commit is contained in:
Argyrios Kyrtzidis 2012-02-04 01:36:04 +00:00
parent c047c4d15b
commit 3d97a9beb9
3 changed files with 12 additions and 12 deletions

View File

@ -153,8 +153,7 @@ protected:
virtual void EndSourceFileAction();
public:
ASTMergeAction(FrontendAction *AdaptedAction,
std::string *ASTFiles, unsigned NumASTFiles);
ASTMergeAction(FrontendAction *AdaptedAction, ArrayRef<std::string> ASTFiles);
virtual ~ASTMergeAction();
virtual bool usesPreprocessorOnly() const;

View File

@ -79,8 +79,8 @@ void ASTMergeAction::EndSourceFileAction() {
}
ASTMergeAction::ASTMergeAction(FrontendAction *AdaptedAction,
std::string *ASTFiles, unsigned NumASTFiles)
: AdaptedAction(AdaptedAction), ASTFiles(ASTFiles, ASTFiles + NumASTFiles) {
ArrayRef<std::string> ASTFiles)
: AdaptedAction(AdaptedAction), ASTFiles(ASTFiles.begin(), ASTFiles.end()) {
assert(AdaptedAction && "ASTMergeAction needs an action to adapt");
}

View File

@ -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;
}