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 argument
72 /// translations this ToolChain may wish to perform.
74 /// \param BoundArch - The bound architecture name, or 0.
75 virtual DerivedArgList *TranslateArgs(InputArgList &Args,
76 const char *BoundArch) const = 0;
78 /// SelectTool - Choose a tool to use to handle the action \arg JA.
79 virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const = 0;
83 std::string GetFilePath(const Compilation &C, const char *Name) const;
84 std::string GetProgramPath(const Compilation &C, const char *Name,
85 bool WantFile = false) const;
87 // Platform defaults information
89 /// IsMathErrnoDefault - Does this tool chain set -fmath-errno by
91 virtual bool IsMathErrnoDefault() const = 0;
93 /// IsUnwindTablesDefault - Does this tool chain use -funwind-tables
95 virtual bool IsUnwindTablesDefault() const = 0;
97 /// GetDefaultRelocationModel - Return the LLVM name of the default
98 /// relocation model for this tool chain.
99 virtual const char *GetDefaultRelocationModel() const = 0;
101 /// GetForcedPicModel - Return the LLVM name of the forced PIC model
102 /// for this tool chain, or 0 if this tool chain does not force a
103 /// particular PIC mode.
104 virtual const char *GetForcedPicModel() const = 0;
107 } // end namespace driver
108 } // end namespace clang