Driver.h revision c35d71f1e0a0c72fd43a73ddecd408bf43d501de
13ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar//===--- Driver.h - Clang GCC Compatible Driver -----------------*- C++ -*-===// 23ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar// 33ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar// The LLVM Compiler Infrastructure 43ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar// 53ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar// This file is distributed under the University of Illinois Open Source 63ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar// License. See LICENSE.TXT for details. 73ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar// 83ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar//===----------------------------------------------------------------------===// 93ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar 103ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar#ifndef CLANG_DRIVER_DRIVER_H_ 113ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar#define CLANG_DRIVER_DRIVER_H_ 123ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar 134ad4b3ebbe5769143389dccfcfadb666a4ba5940Daniel Dunbar#include "clang/Basic/Diagnostic.h" 144ad4b3ebbe5769143389dccfcfadb666a4ba5940Daniel Dunbar 15ad2a9af666efdd9afe3bb5f886bcb0d1c9a0f0c3Daniel Dunbar#include "clang/Driver/Phases.h" 16d65bddcbe1385a4de212ecbbdc8919c54b3efeb0Daniel Dunbar#include "clang/Driver/Util.h" 17d65bddcbe1385a4de212ecbbdc8919c54b3efeb0Daniel Dunbar 18cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar#include "llvm/System/Path.h" // FIXME: Kill when CompilationInfo 19cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar // lands. 20365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar#include <list> 21365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar#include <set> 22365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar#include <string> 23365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar 243ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbarnamespace clang { 251b3bb6efc59a21f794b534078f9ae7e95393f510Daniel Dunbarnamespace driver { 2653ec55215075c8f4ddd47ca6ed7d382f16beb670Daniel Dunbar class Action; 270648262df75d97b464c2be0ed867da3615659785Daniel Dunbar class ArgList; 283ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar class Compilation; 29365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar class HostInfo; 30f3cad36e59a41b5767fe662b5ac8911ee174b801Daniel Dunbar class InputArgList; 31f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar class InputInfo; 32441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar class JobAction; 331b3bb6efc59a21f794b534078f9ae7e95393f510Daniel Dunbar class OptTable; 34f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar class PipedJob; 35cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar class ToolChain; 363ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar 373ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar/// Driver - Encapsulate logic for constructing compilation processes 383ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar/// from a set of gcc-driver-like command line arguments. 393ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbarclass Driver { 401b3bb6efc59a21f794b534078f9ae7e95393f510Daniel Dunbar OptTable *Opts; 411b3bb6efc59a21f794b534078f9ae7e95393f510Daniel Dunbar 424ad4b3ebbe5769143389dccfcfadb666a4ba5940Daniel Dunbar Diagnostic &Diags; 434ad4b3ebbe5769143389dccfcfadb666a4ba5940Daniel Dunbar 441d46033f760ba5fd266ce59fe391fac473f04f52Daniel Dunbarpublic: 454ad4b3ebbe5769143389dccfcfadb666a4ba5940Daniel Dunbar // Diag - Forwarding function for diagnostics. 4657b704d8d8f49bcaf856a3e37941d5ac6456eb50Daniel Dunbar DiagnosticBuilder Diag(unsigned DiagID) const { 474ad4b3ebbe5769143389dccfcfadb666a4ba5940Daniel Dunbar return Diags.Report(FullSourceLoc(), DiagID); 484ad4b3ebbe5769143389dccfcfadb666a4ba5940Daniel Dunbar } 494ad4b3ebbe5769143389dccfcfadb666a4ba5940Daniel Dunbar 50365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar // FIXME: Privatize once interface is stable. 51365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbarpublic: 52365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar /// The name the driver was invoked as. 53365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar std::string Name; 54365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar 55365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar /// The path the driver executable was in, as invoked from the 56365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar /// command line. 57365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar std::string Dir; 58dd98e2cad165ca73c769e4f105a4e47c2216387aDaniel Dunbar 59dd98e2cad165ca73c769e4f105a4e47c2216387aDaniel Dunbar /// Default host triple. 60dd98e2cad165ca73c769e4f105a4e47c2216387aDaniel Dunbar std::string DefaultHostTriple; 61365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar 62f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar /// Default name for linked images (e.g., "a.out"). 63f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar std::string DefaultImageName; 64f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar 65365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar /// Host information for the platform the driver is running as. This 66365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar /// will generally be the actual host platform, but not always. 671fd6c4b8abbbdcbae0e221f35100102112dabff2Daniel Dunbar const HostInfo *Host; 68365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar 69365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar /// Information about the host which can be overriden by the user. 70365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar std::string HostBits, HostMachine, HostSystem, HostRelease; 71365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar 72365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar /// Whether the driver should follow g++ like behavior. 73365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar bool CCCIsCXX : 1; 74365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar 75365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar /// Echo commands while executing (in -v style). 76365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar bool CCCEcho : 1; 77365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar 785c3c1d7b494660ba5e8983ee4584622750725ac2Daniel Dunbar /// Only print tool bindings, don't build any jobs. 795c3c1d7b494660ba5e8983ee4584622750725ac2Daniel Dunbar bool CCCPrintBindings : 1; 805c3c1d7b494660ba5e8983ee4584622750725ac2Daniel Dunbar 8178d8a089c8f124ba6f47bb37e2c4a36986f60e23Daniel Dunbar /// Name to use when calling the generic gcc. 8278d8a089c8f124ba6f47bb37e2c4a36986f60e23Daniel Dunbar std::string CCCGenericGCCName; 8378d8a089c8f124ba6f47bb37e2c4a36986f60e23Daniel Dunbar 84af80e1ffafeb77929cc0b9ba8940a7f1c0b80d51Daniel Dunbarprivate: 850f99d2e57d8e3cf2508e7f9f868d41eccdc229c9Daniel Dunbar /// Use the clang compiler where possible. 860f99d2e57d8e3cf2508e7f9f868d41eccdc229c9Daniel Dunbar bool CCCUseClang : 1; 87365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar 880f99d2e57d8e3cf2508e7f9f868d41eccdc229c9Daniel Dunbar /// Use clang for handling C++ and Objective-C++ inputs. 890f99d2e57d8e3cf2508e7f9f868d41eccdc229c9Daniel Dunbar bool CCCUseClangCXX : 1; 90365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar 910f99d2e57d8e3cf2508e7f9f868d41eccdc229c9Daniel Dunbar /// Use clang as a preprocessor (clang's preprocessor will still be 920f99d2e57d8e3cf2508e7f9f868d41eccdc229c9Daniel Dunbar /// used where an integrated CPP would). 930f99d2e57d8e3cf2508e7f9f868d41eccdc229c9Daniel Dunbar bool CCCUseClangCPP : 1; 94365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar 950f99d2e57d8e3cf2508e7f9f868d41eccdc229c9Daniel Dunbar /// Only use clang for the given architectures (only used when 960f99d2e57d8e3cf2508e7f9f868d41eccdc229c9Daniel Dunbar /// non-empty). 97365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar std::set<std::string> CCCClangArchs; 98365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar 99365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar /// Certain options suppress the 'no input files' warning. 100365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar bool SuppressMissingInputWarning : 1; 101365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar 102365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar std::list<std::string> TempFiles; 103365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar std::list<std::string> ResultFiles; 104365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar 1053ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbarpublic: 106dd98e2cad165ca73c769e4f105a4e47c2216387aDaniel Dunbar Driver(const char *_Name, const char *_Dir, 1074ad4b3ebbe5769143389dccfcfadb666a4ba5940Daniel Dunbar const char *_DefaultHostTriple, 108f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar const char *_DefaultImageName, 1094ad4b3ebbe5769143389dccfcfadb666a4ba5940Daniel Dunbar Diagnostic &_Diags); 1103ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar ~Driver(); 1113ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar 112cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// @name Accessors 113cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// @{ 114cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar 1151b3bb6efc59a21f794b534078f9ae7e95393f510Daniel Dunbar const OptTable &getOpts() const { return *Opts; } 1161b3bb6efc59a21f794b534078f9ae7e95393f510Daniel Dunbar 117af96def468042cfbed55a4cc12b1bb917ead4f33Daniel Dunbar const Diagnostic &getDiags() const { return Diags; } 118af96def468042cfbed55a4cc12b1bb917ead4f33Daniel Dunbar 119cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// @} 120cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// @name Primary Functionality 121cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// @{ 122cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar 1233ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar /// BuildCompilation - Construct a compilation object for a command 1243ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar /// line argument vector. 125cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// 126cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// \return A compilation, or 0 if none was built for the given 127cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// argument vector. A null return value does not necessarily 128cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// indicate an error condition, the diagnostics should be queried 129cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// to determine if an error occurred. 1303ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar Compilation *BuildCompilation(int argc, const char **argv); 131365c02f65be026f90e67a8e00e7b827cee60e228Daniel Dunbar 132cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// @name Driver Steps 133cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// @{ 13453ec55215075c8f4ddd47ca6ed7d382f16beb670Daniel Dunbar 13557b704d8d8f49bcaf856a3e37941d5ac6456eb50Daniel Dunbar /// ParseArgStrings - Parse the given list of strings into an 13657b704d8d8f49bcaf856a3e37941d5ac6456eb50Daniel Dunbar /// ArgList. 137f3cad36e59a41b5767fe662b5ac8911ee174b801Daniel Dunbar InputArgList *ParseArgStrings(const char **ArgBegin, const char **ArgEnd); 13857b704d8d8f49bcaf856a3e37941d5ac6456eb50Daniel Dunbar 13957b704d8d8f49bcaf856a3e37941d5ac6456eb50Daniel Dunbar /// BuildActions - Construct the list of actions to perform for the 14057b704d8d8f49bcaf856a3e37941d5ac6456eb50Daniel Dunbar /// given arguments, which are only done for a single architecture. 14153ec55215075c8f4ddd47ca6ed7d382f16beb670Daniel Dunbar /// 14253ec55215075c8f4ddd47ca6ed7d382f16beb670Daniel Dunbar /// \param Args - The input arguments. 14353ec55215075c8f4ddd47ca6ed7d382f16beb670Daniel Dunbar /// \param Actions - The list to store the resulting actions onto. 14421549237f14505cfc2a18a06416372a36229d0ceDaniel Dunbar void BuildActions(const ArgList &Args, ActionList &Actions) const; 14553ec55215075c8f4ddd47ca6ed7d382f16beb670Daniel Dunbar 14657b704d8d8f49bcaf856a3e37941d5ac6456eb50Daniel Dunbar /// BuildUniversalActions - Construct the list of actions to perform 14757b704d8d8f49bcaf856a3e37941d5ac6456eb50Daniel Dunbar /// for the given arguments, which may require a universal build. 14853ec55215075c8f4ddd47ca6ed7d382f16beb670Daniel Dunbar /// 14953ec55215075c8f4ddd47ca6ed7d382f16beb670Daniel Dunbar /// \param Args - The input arguments. 15053ec55215075c8f4ddd47ca6ed7d382f16beb670Daniel Dunbar /// \param Actions - The list to store the resulting actions onto. 151d9c834f6af12ab21d5d4af8150e6fb94eadda043Daniel Dunbar void BuildUniversalActions(const ArgList &Args, ActionList &Actions) const; 15257b704d8d8f49bcaf856a3e37941d5ac6456eb50Daniel Dunbar 15357b704d8d8f49bcaf856a3e37941d5ac6456eb50Daniel Dunbar /// BuildJobs - Bind actions to concrete tools and translate 15457b704d8d8f49bcaf856a3e37941d5ac6456eb50Daniel Dunbar /// arguments to form the list of jobs to run. 155586dc233bb88f2920c9f3638f69cef0ccd55dcedDaniel Dunbar /// 156586dc233bb88f2920c9f3638f69cef0ccd55dcedDaniel Dunbar /// \arg C - The compilation that is being built. 15721549237f14505cfc2a18a06416372a36229d0ceDaniel Dunbar void BuildJobs(Compilation &C) const; 158cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar 159cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// @} 160cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// @name Helper Methods 161cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// @{ 162cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar 16391e28afe3503893c69afd71877f11e3bf03fa4ceDaniel Dunbar /// PrintActions - Print the list of actions. 16491e28afe3503893c69afd71877f11e3bf03fa4ceDaniel Dunbar void PrintActions(const Compilation &C) const; 16591e28afe3503893c69afd71877f11e3bf03fa4ceDaniel Dunbar 166c35d71f1e0a0c72fd43a73ddecd408bf43d501deDaniel Dunbar /// PrintHelp - Print the help text. 167c35d71f1e0a0c72fd43a73ddecd408bf43d501deDaniel Dunbar /// 168c35d71f1e0a0c72fd43a73ddecd408bf43d501deDaniel Dunbar /// \param ShowHidden - Show hidden options. 169c35d71f1e0a0c72fd43a73ddecd408bf43d501deDaniel Dunbar void PrintHelp(bool ShowHidden) const; 17091e28afe3503893c69afd71877f11e3bf03fa4ceDaniel Dunbar 171cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// PrintOptions - Print the list of arguments. 172cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar void PrintOptions(const ArgList &Args) const; 173cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar 174cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// PrintVersion - Print the driver version. 17570c8db1003af49d3627aeef41fcdd7c6c6a7df79Daniel Dunbar void PrintVersion(const Compilation &C) const; 176cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar 177cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// GetFilePath - Lookup \arg Name in the list of file search paths. 1782ba38ba9a18b8ec88e2509fad622eeec01562769Daniel Dunbar /// 17921549237f14505cfc2a18a06416372a36229d0ceDaniel Dunbar /// \arg TC - The tool chain for additional information on 18021549237f14505cfc2a18a06416372a36229d0ceDaniel Dunbar /// directories to search. 181cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar // FIXME: This should be in CompilationInfo. 18221549237f14505cfc2a18a06416372a36229d0ceDaniel Dunbar llvm::sys::Path GetFilePath(const char *Name, const ToolChain &TC) const; 183cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar 184cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// GetProgramPath - Lookup \arg Name in the list of program search 185cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// paths. 1862ba38ba9a18b8ec88e2509fad622eeec01562769Daniel Dunbar /// 18721549237f14505cfc2a18a06416372a36229d0ceDaniel Dunbar /// \arg TC - The provided tool chain for additional information on 18821549237f14505cfc2a18a06416372a36229d0ceDaniel Dunbar /// directories to search. 189950bedd8a9f00caabd2f1fc6812d70e08103f847Mike Stump /// 190950bedd8a9f00caabd2f1fc6812d70e08103f847Mike Stump /// \arg WantFile - False when searching for an executable file, otherwise 191950bedd8a9f00caabd2f1fc6812d70e08103f847Mike Stump /// true. Defaults to false. 192cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar // FIXME: This should be in CompilationInfo. 193950bedd8a9f00caabd2f1fc6812d70e08103f847Mike Stump llvm::sys::Path GetProgramPath(const char *Name, const ToolChain &TC, 194950bedd8a9f00caabd2f1fc6812d70e08103f847Mike Stump bool WantFile = false) const; 195cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar 196cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// HandleImmediateArgs - Handle any arguments which should be 197cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// treated before building actions or binding tools. 198cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// 199cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// \return Whether any compilation should be built for this 200cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// invocation. 20121549237f14505cfc2a18a06416372a36229d0ceDaniel Dunbar bool HandleImmediateArgs(const Compilation &C); 202cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar 203ad2a9af666efdd9afe3bb5f886bcb0d1c9a0f0c3Daniel Dunbar /// ConstructAction - Construct the appropriate action to do for 204ad2a9af666efdd9afe3bb5f886bcb0d1c9a0f0c3Daniel Dunbar /// \arg Phase on the \arg Input, taking in to account arguments 205ad2a9af666efdd9afe3bb5f886bcb0d1c9a0f0c3Daniel Dunbar /// like -fsyntax-only or --analyze. 206ad2a9af666efdd9afe3bb5f886bcb0d1c9a0f0c3Daniel Dunbar Action *ConstructPhaseAction(const ArgList &Args, phases::ID Phase, 207ad2a9af666efdd9afe3bb5f886bcb0d1c9a0f0c3Daniel Dunbar Action *Input) const; 208ad2a9af666efdd9afe3bb5f886bcb0d1c9a0f0c3Daniel Dunbar 209f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar 210f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar /// BuildJobsForAction - Construct the jobs to perform for the 211f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar /// action \arg A. 212f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar void BuildJobsForAction(Compilation &C, 213f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar const Action *A, 214f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar const ToolChain *TC, 215f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar bool CanAcceptPipe, 216f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar bool AtTopLevel, 217f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar const char *LinkingOutput, 218f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar InputInfo &Result) const; 219f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar 220441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar /// GetNamedOutputPath - Return the name to use for the output of 221441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar /// the action \arg JA. The result is appended to the compilation's 222441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar /// list of temporary or result files, as appropriate. 223441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar /// 224441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar /// \param C - The compilation. 225441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar /// \param JA - The action of interest. 226441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar /// \param BaseInput - The original input file that this action was 227441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar /// triggered by. 228441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar /// \param AtTopLevel - Whether this is a "top-level" action. 229441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar const char *GetNamedOutputPath(Compilation &C, 230441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar const JobAction &JA, 231441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar const char *BaseInput, 232441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar bool AtTopLevel) const; 233441d060838a5797691777dfcc992ff836b73dcd1Daniel Dunbar 234214399ebd73545dde02b4a45872e7ca9e1d9e742Daniel Dunbar /// GetTemporaryPath - Return the pathname of a temporary file to 235214399ebd73545dde02b4a45872e7ca9e1d9e742Daniel Dunbar /// use as part of compilation; the file will have the given suffix. 236214399ebd73545dde02b4a45872e7ca9e1d9e742Daniel Dunbar /// 237214399ebd73545dde02b4a45872e7ca9e1d9e742Daniel Dunbar /// GCC goes to extra lengths here to be a bit more robust. 238214399ebd73545dde02b4a45872e7ca9e1d9e742Daniel Dunbar std::string GetTemporaryPath(const char *Suffix) const; 239214399ebd73545dde02b4a45872e7ca9e1d9e742Daniel Dunbar 240cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// GetHostInfo - Construct a new host info object for the given 241cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// host triple. 242e504952bc89f79fc9ff54d5641ab30bb07ec435eDaniel Dunbar const HostInfo *GetHostInfo(const char *HostTriple) const; 243cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar 244af80e1ffafeb77929cc0b9ba8940a7f1c0b80d51Daniel Dunbar /// ShouldUseClangCompilar - Should the clang compiler be used to 245af80e1ffafeb77929cc0b9ba8940a7f1c0b80d51Daniel Dunbar /// handle this action. 246af80e1ffafeb77929cc0b9ba8940a7f1c0b80d51Daniel Dunbar bool ShouldUseClangCompiler(const Compilation &C, const JobAction &JA, 247af80e1ffafeb77929cc0b9ba8940a7f1c0b80d51Daniel Dunbar const std::string &ArchName) const; 248af80e1ffafeb77929cc0b9ba8940a7f1c0b80d51Daniel Dunbar 249cb881672c2c46142ec1bdfa401c9818ae805db0fDaniel Dunbar /// @} 250d73fe9b70c5f6738d004744562287a62831f39bfDaniel Dunbar 251d73fe9b70c5f6738d004744562287a62831f39bfDaniel Dunbar /// GetReleaseVersion - Parse (([0-9]+)(.([0-9]+)(.([0-9]+)?))?)? and 252d73fe9b70c5f6738d004744562287a62831f39bfDaniel Dunbar /// return the grouped values as integers. Numbers which are not 253d73fe9b70c5f6738d004744562287a62831f39bfDaniel Dunbar /// provided are set to 0. 254d73fe9b70c5f6738d004744562287a62831f39bfDaniel Dunbar /// 255d73fe9b70c5f6738d004744562287a62831f39bfDaniel Dunbar /// \return True if the entire string was parsed (9.2), or all 256d73fe9b70c5f6738d004744562287a62831f39bfDaniel Dunbar /// groups were parsed (10.3.5extrastuff). HadExtra is true if all 257d73fe9b70c5f6738d004744562287a62831f39bfDaniel Dunbar /// groups were parsed but extra characters remain at the end. 258d73fe9b70c5f6738d004744562287a62831f39bfDaniel Dunbar static bool GetReleaseVersion(const char *Str, unsigned &Major, 259d73fe9b70c5f6738d004744562287a62831f39bfDaniel Dunbar unsigned &Minor, unsigned &Micro, 260d73fe9b70c5f6738d004744562287a62831f39bfDaniel Dunbar bool &HadExtra); 2613ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar}; 2623ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar 2631b3bb6efc59a21f794b534078f9ae7e95393f510Daniel Dunbar} // end namespace driver 2643ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar} // end namespace clang 2653ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar 2663ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar#endif 267