From 446f6843323cdb45f7f3099c8d7c9c98e4196cc1 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 12 Mar 2009 18:24:49 +0000 Subject: [PATCH] Driver: Introduce ActionList typedef, tweak some constness. llvm-svn: 66809 --- clang/include/clang/Driver/Driver.h | 17 ++++++----------- clang/include/clang/Driver/Util.h | 8 +++++++- clang/lib/Driver/Driver.cpp | 12 +++++------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/clang/include/clang/Driver/Driver.h b/clang/include/clang/Driver/Driver.h index 1dcb8af8f1eb..dc1814cb6d14 100644 --- a/clang/include/clang/Driver/Driver.h +++ b/clang/include/clang/Driver/Driver.h @@ -12,15 +12,12 @@ #include "clang/Basic/Diagnostic.h" +#include "clang/Driver/Util.h" + #include #include #include -namespace llvm { - template class SmallVector; - class raw_ostream; -} - namespace clang { namespace driver { class Action; @@ -103,10 +100,10 @@ public: Compilation *BuildCompilation(int argc, const char **argv); /// PrintOptions - Print the list of arguments. - void PrintOptions(const ArgList &Args); + void PrintOptions(const ArgList &Args) const; /// PrintActions - Print the list of actions. - void PrintActions(const llvm::SmallVector &Actions); + void PrintActions(const ActionList &Actions) const; /// GetHostInfo - Construct a new host info object for the given /// host triple. @@ -117,16 +114,14 @@ public: /// /// \param Args - The input arguments. /// \param Actions - The list to store the resulting actions onto. - void BuildUniversalActions(const ArgList &Args, - llvm::SmallVector &Actions); + void BuildUniversalActions(ArgList &Args, ActionList &Actions); /// BuildActions - Construct the list of actions to perform for the /// given arguments, which are only done for a single architecture. /// /// \param Args - The input arguments. /// \param Actions - The list to store the resulting actions onto. - void BuildActions(const ArgList &Args, - llvm::SmallVector &Actions); + void BuildActions(ArgList &Args, ActionList &Actions); }; } // end namespace driver diff --git a/clang/include/clang/Driver/Util.h b/clang/include/clang/Driver/Util.h index eb5d2471c827..465d81a1f383 100644 --- a/clang/include/clang/Driver/Util.h +++ b/clang/include/clang/Driver/Util.h @@ -10,13 +10,19 @@ #ifndef CLANG_DRIVER_UTIL_H_ #define CLANG_DRIVER_UTIL_H_ -#include "llvm/ADT/SmallVector.h" +namespace llvm { + template class SmallVector; +} namespace clang { namespace driver { + class Action; + /// ArgStringList - Type used for constructing argv lists for subprocesses. typedef llvm::SmallVector ArgStringList; + /// ActionList - Type used for lists of actions. + typedef llvm::SmallVector ActionList; } // end namespace driver } // end namespace clang diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 61cc89545cc6..2b763c6ae572 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -132,7 +132,7 @@ Compilation *Driver::BuildCompilation(int argc, const char **argv) { // Construct the list of abstract actions to perform for this // compilation. - llvm::SmallVector Actions; + ActionList Actions; if (Host->useDriverDriver()) BuildUniversalActions(*Args, Actions); else @@ -149,7 +149,7 @@ Compilation *Driver::BuildCompilation(int argc, const char **argv) { return new Compilation(); } -void Driver::PrintOptions(const ArgList &Args) { +void Driver::PrintOptions(const ArgList &Args) const { unsigned i = 0; for (ArgList::const_iterator it = Args.begin(), ie = Args.end(); it != ie; ++it, ++i) { @@ -166,18 +166,16 @@ void Driver::PrintOptions(const ArgList &Args) { } } -void Driver::PrintActions(const llvm::SmallVector &Actions) { +void Driver::PrintActions(const ActionList &Actions) const { llvm::errs() << "FIXME: Print actions."; } -void Driver::BuildUniversalActions(const ArgList &Args, - llvm::SmallVector &Actions) { +void Driver::BuildUniversalActions(ArgList &Args, ActionList &Actions) { // FIXME: Implement BuildActions(Args, Actions); } -void Driver::BuildActions(const ArgList &Args, - llvm::SmallVector &Actions) { +void Driver::BuildActions(ArgList &Args, ActionList &Actions) { types::ID InputType = types::TY_INVALID; Arg *InputTypeArg = 0;