1 //===--- ToolChain.h - Collections of tools for one platform ----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef CLANG_DRIVER_TOOLCHAIN_H_
11 #define CLANG_DRIVER_TOOLCHAIN_H_
13 #include "llvm/ADT/SmallVector.h"
14 #include "llvm/ADT/Triple.h"
15 #include "llvm/System/Path.h"
27 /// ToolChain - Access to tools for a single platform.
30 typedef llvm::SmallVector<std::string, 4> path_list;
34 const llvm::Triple Triple;
36 /// The list of toolchain specific path prefixes to search for
40 /// The list of toolchain specific path prefixes to search for
42 path_list ProgramPaths;
45 ToolChain(const HostInfo &Host, const llvm::Triple &_Triple);
52 const HostInfo &getHost() const { return Host; }
53 const llvm::Triple &getTriple() const { return Triple; }
55 std::string getArchName() const { return Triple.getArchName(); }
56 std::string getPlatform() const { return Triple.getVendorName(); }
57 std::string getOS() const { return Triple.getOSName(); }
59 std::string getTripleString() const {
60 return Triple.getTriple();
63 path_list &getFilePaths() { return FilePaths; }
64 const path_list &getFilePaths() const { return FilePaths; }
66 path_list &getProgramPaths() { return ProgramPaths; }
67 const path_list &getProgramPaths() const { return ProgramPaths; }
71 /// TranslateArgs - Create a new derived argument list for any
72 /// argument translations this ToolChain may wish to perform.
73 virtual DerivedArgList *TranslateArgs(InputArgList &Args) const = 0;
75 /// SelectTool - Choose a tool to use to handle the action \arg JA.
76 virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const = 0;
80 llvm::sys::Path GetFilePath(const Compilation &C, const char *Name) const;
81 llvm::sys::Path GetProgramPath(const Compilation &C, const char *Name,
82 bool WantFile = false) const;
84 // Platform defaults information
86 /// IsMathErrnoDefault - Does this tool chain set -fmath-errno by
88 virtual bool IsMathErrnoDefault() const = 0;
90 /// IsUnwindTablesDefault - Does this tool chain use -funwind-tables
92 virtual bool IsUnwindTablesDefault() const = 0;
94 /// GetDefaultRelocationModel - Return the LLVM name of the default
95 /// relocation model for this tool chain.
96 virtual const char *GetDefaultRelocationModel() const = 0;
98 /// GetForcedPicModel - Return the LLVM name of the forced PIC model
99 /// for this tool chain, or 0 if this tool chain does not force a
100 /// particular PIC mode.
101 virtual const char *GetForcedPicModel() const = 0;
104 } // end namespace driver
105 } // end namespace clang