diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-10-20 21:14:49 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-10-20 21:14:49 +0000 |
commit | 36981b17ed939300f6f8fc2355a255f711fcef71 (patch) | |
tree | ee2483e98b09cac943dc93a6969d83ca737ff139 /include/clang/Driver/Driver.h | |
parent | 180abc3db9ae3b4fc63cd65b15697e6ffcc8a657 (diff) |
Notes
Diffstat (limited to 'include/clang/Driver/Driver.h')
-rw-r--r-- | include/clang/Driver/Driver.h | 67 |
1 files changed, 49 insertions, 18 deletions
diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h index b6951663148b..6fdf6fcfad64 100644 --- a/include/clang/Driver/Driver.h +++ b/include/clang/Driver/Driver.h @@ -13,6 +13,7 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Driver/Phases.h" +#include "clang/Driver/Types.h" #include "clang/Driver/Util.h" #include "llvm/ADT/StringRef.h" @@ -24,13 +25,14 @@ #include <string> namespace llvm { - class raw_ostream; template<typename T> class ArrayRef; } namespace clang { namespace driver { class Action; + class Arg; class ArgList; + class Command; class Compilation; class DerivedArgList; class HostInfo; @@ -45,7 +47,7 @@ namespace driver { class Driver { OptTable *Opts; - Diagnostic &Diags; + DiagnosticsEngine &Diags; public: // Diag - Forwarding function for diagnostics. @@ -75,7 +77,7 @@ public: /// functionality. /// FIXME: This type of customization should be removed in favor of the /// universal driver when it is ready. - typedef llvm::SmallVector<std::string, 4> prefix_list; + typedef SmallVector<std::string, 4> prefix_list; prefix_list PrefixDirs; /// sysroot, if present @@ -109,6 +111,9 @@ public: /// The file to log CC_LOG_DIAGNOSTICS output to, if enabled. const char *CCLogDiagnosticsFilename; + /// A list of inputs and their types for the given arguments. + typedef SmallVector<std::pair<types::ID, const Arg*>, 16> InputList; + /// Whether the driver should follow g++ like behavior. unsigned CCCIsCXX : 1; @@ -134,6 +139,9 @@ public: /// format. unsigned CCLogDiagnostics : 1; + /// Whether the driver is generating diagnostics for debugging purposes. + unsigned CCGenDiagnostics : 1; + private: /// Name to use when invoking gcc/g++. std::string CCCGenericGCCName; @@ -172,12 +180,17 @@ private: /// arguments, after applying the standard argument translations. DerivedArgList *TranslateInputArgs(const InputArgList &Args) const; + // getFinalPhase - Determine which compilation mode we are in and record + // which option we used to determine the final phase. + phases::ID getFinalPhase(const DerivedArgList &DAL, Arg **FinalPhaseArg = 0) + const; + public: - Driver(llvm::StringRef _ClangExecutable, - llvm::StringRef _DefaultHostTriple, - llvm::StringRef _DefaultImageName, - bool IsProduction, bool CXXIsProduction, - Diagnostic &_Diags); + Driver(StringRef _ClangExecutable, + StringRef _DefaultHostTriple, + StringRef _DefaultImageName, + bool IsProduction, + DiagnosticsEngine &_Diags); ~Driver(); /// @name Accessors @@ -189,7 +202,7 @@ public: const OptTable &getOpts() const { return *Opts; } - const Diagnostic &getDiags() const { return Diags; } + const DiagnosticsEngine &getDiags() const { return Diags; } bool getCheckInputsExist() const { return CheckInputsExist; } @@ -209,7 +222,7 @@ public: return InstalledDir.c_str(); return Dir.c_str(); } - void setInstalledDir(llvm::StringRef Value) { + void setInstalledDir(StringRef Value) { InstalledDir = Value; } @@ -224,14 +237,24 @@ public: /// argument vector. A null return value does not necessarily /// indicate an error condition, the diagnostics should be queried /// to determine if an error occurred. - Compilation *BuildCompilation(llvm::ArrayRef<const char *> Args); + Compilation *BuildCompilation(ArrayRef<const char *> Args); /// @name Driver Steps /// @{ /// ParseArgStrings - Parse the given list of strings into an /// ArgList. - InputArgList *ParseArgStrings(llvm::ArrayRef<const char *> Args); + InputArgList *ParseArgStrings(ArrayRef<const char *> Args); + + /// BuildInputs - Construct the list of inputs and their types from + /// the given arguments. + /// + /// \param TC - The default host tool chain. + /// \param Args - The input arguments. + /// \param Inputs - The list to store the resulting compilation + /// inputs onto. + void BuildInputs(const ToolChain &TC, const DerivedArgList &Args, + InputList &Inputs) const; /// BuildActions - Construct the list of actions to perform for the /// given arguments, which are only done for a single architecture. @@ -240,7 +263,7 @@ public: /// \param Args - The input arguments. /// \param Actions - The list to store the resulting actions onto. void BuildActions(const ToolChain &TC, const DerivedArgList &Args, - ActionList &Actions) const; + const InputList &Inputs, ActionList &Actions) const; /// BuildUniversalActions - Construct the list of actions to perform /// for the given arguments, which may require a universal build. @@ -249,6 +272,7 @@ public: /// \param Args - The input arguments. /// \param Actions - The list to store the resulting actions onto. void BuildUniversalActions(const ToolChain &TC, const DerivedArgList &Args, + const InputList &BAInputs, ActionList &Actions) const; /// BuildJobs - Bind actions to concrete tools and translate @@ -263,7 +287,14 @@ public: /// This routine handles additional processing that must be done in addition /// to just running the subprocesses, for example reporting errors, removing /// temporary files, etc. - int ExecuteCompilation(const Compilation &C) const; + int ExecuteCompilation(const Compilation &C, + const Command *&FailingCommand) const; + + /// generateCompilationDiagnostics - Generate diagnostics information + /// including preprocessed source file(s). + /// + void generateCompilationDiagnostics(Compilation &C, + const Command *FailingCommand); /// @} /// @name Helper Methods @@ -281,7 +312,7 @@ public: void PrintOptions(const ArgList &Args) const; /// PrintVersion - Print the driver version. - void PrintVersion(const Compilation &C, llvm::raw_ostream &OS) const; + void PrintVersion(const Compilation &C, raw_ostream &OS) const; /// GetFilePath - Lookup \arg Name in the list of file search paths. /// @@ -342,11 +373,11 @@ public: const char *BaseInput, bool AtTopLevel) const; - /// GetTemporaryPath - Return the pathname of a temporary file to - /// use as part of compilation; the file will have the given suffix. + /// GetTemporaryPath - Return the pathname of a temporary file to use + /// as part of compilation; the file will have the given prefix and suffix. /// /// GCC goes to extra lengths here to be a bit more robust. - std::string GetTemporaryPath(const char *Suffix) const; + std::string GetTemporaryPath(StringRef Prefix, const char *Suffix) const; /// GetHostInfo - Construct a new host info object for the given /// host triple. |