]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - contrib/llvm/tools/clang/include/clang/Driver/HostInfo.h
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / contrib / llvm / tools / clang / include / clang / Driver / HostInfo.h
1 //===--- HostInfo.h - Host specific information -----------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef CLANG_DRIVER_HOSTINFO_H_
11 #define CLANG_DRIVER_HOSTINFO_H_
12
13 #include "llvm/ADT/Triple.h"
14 #include <string>
15
16 namespace clang {
17 namespace driver {
18   class ArgList;
19   class Driver;
20   class ToolChain;
21
22 /// HostInfo - Config information about a particular host which may interact
23 /// with driver behavior.
24 ///
25 /// The host information is used for controlling the parts of the driver which
26 /// interact with the platform the driver is ostensibly being run from. For
27 /// testing purposes, the HostInfo used by the driver may differ from the actual
28 /// host.
29 class HostInfo {
30 protected:
31   const Driver &TheDriver;
32   const llvm::Triple Triple;
33
34   HostInfo(const Driver &D, const llvm::Triple &_Triple);
35
36 public:
37   virtual ~HostInfo();
38
39   const Driver &getDriver() const { return TheDriver; }
40
41   const llvm::Triple& getTriple() const { return Triple; }
42   std::string getArchName() const { return Triple.getArchName(); }
43   std::string getPlatformName() const { return Triple.getVendorName(); }
44   std::string getOSName() const { return Triple.getOSName(); }
45
46   /// useDriverDriver - Whether the driver should act as a driver driver for
47   /// this host and support -arch, -Xarch, etc.
48   virtual bool useDriverDriver() const = 0;
49
50   /// CreateToolChain - Construct the toolchain to use for this host (which the
51   /// host retains ownership of).
52   ///
53   /// \param Args - The argument list, which may be used to alter the default
54   /// toolchain, for example in the presence of -m32 or -m64.
55   ///
56   /// \param ArchName - The architecture to return a toolchain for, or 0 if
57   /// unspecified. This will only ever be non-zero for hosts which support a
58   /// driver driver.
59
60   // FIXME: Pin down exactly what the HostInfo is allowed to use Args
61   // for here. Currently this is for -m32 / -m64 defaulting.
62   virtual ToolChain *CreateToolChain(const ArgList &Args,
63                                      const char *ArchName=0) const = 0;
64 };
65
66 const HostInfo *createAuroraUXHostInfo(const Driver &D,
67                                        const llvm::Triple& Triple);
68 const HostInfo *createDarwinHostInfo(const Driver &D,
69                                      const llvm::Triple& Triple);
70 const HostInfo *createOpenBSDHostInfo(const Driver &D,
71                                       const llvm::Triple& Triple);
72 const HostInfo *createFreeBSDHostInfo(const Driver &D,
73                                       const llvm::Triple& Triple);
74 const HostInfo *createNetBSDHostInfo(const Driver &D,
75                                       const llvm::Triple& Triple);
76 const HostInfo *createMinixHostInfo(const Driver &D,
77                                       const llvm::Triple& Triple);
78 const HostInfo *createDragonFlyHostInfo(const Driver &D,
79                                         const llvm::Triple& Triple);
80 const HostInfo *createLinuxHostInfo(const Driver &D,
81                                     const llvm::Triple& Triple);
82 const HostInfo *createTCEHostInfo(const Driver &D, 
83                                   const llvm::Triple& Triple);
84 const HostInfo *createWindowsHostInfo(const Driver &D,
85                                       const llvm::Triple &Triple);
86 const HostInfo *createMinGWHostInfo(const Driver &D,
87                                     const llvm::Triple &Triple);
88 const HostInfo *createUnknownHostInfo(const Driver &D,
89                                       const llvm::Triple& Triple);
90
91 } // end namespace driver
92 } // end namespace clang
93
94 #endif