 |
|
 |
|
| Files: |
1 |
|
Branches Taken: |
0.0% |
0 / 0 |
| Generated: |
2010-02-10 01:31 |
|
Branches Executed: |
0.0% |
0 / 0 |
| |
|
Line Coverage: |
100.0% |
4 / 4 |
| |
 |
|
 |
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 "clang/Driver/Types.h"
14 : #include "llvm/ADT/Triple.h"
15 : #include <string>
16 :
17 : namespace clang {
18 : namespace driver {
19 : class ArgList;
20 : class Driver;
21 : class ToolChain;
22 :
23 : /// HostInfo - Config information about a particular host which may interact
24 : /// with driver behavior.
25 : ///
26 : /// The host information is used for controlling the parts of the driver which
27 : /// interact with the platform the driver is ostensibly being run from. For
28 : /// testing purposes, the HostInfo used by the driver may differ from the actual
29 : /// host.
30 : class HostInfo {
31 : protected:
32 : const Driver &TheDriver;
33 : const llvm::Triple Triple;
34 :
35 : HostInfo(const Driver &D, const llvm::Triple &_Triple);
36 :
37 : public:
38 : virtual ~HostInfo();
39 :
40 1342: const Driver &getDriver() const { return TheDriver; }
41 :
42 291: const llvm::Triple& getTriple() const { return Triple; }
43 189: std::string getArchName() const { return Triple.getArchName(); }
44 : std::string getPlatformName() const { return Triple.getVendorName(); }
45 120: std::string getOSName() const { return Triple.getOSName(); }
46 :
47 : /// useDriverDriver - Whether the driver should act as a driver driver for
48 : /// this host and support -arch, -Xarch, etc.
49 : virtual bool useDriverDriver() const = 0;
50 :
51 : /// lookupTypeForExtension - Return the default language type to use for the
52 : /// given extension.
53 : virtual types::ID lookupTypeForExtension(const char *Ext) const = 0;
54 :
55 : /// CreateToolChain - Construct the toolchain to use for this host (which the
56 : /// host retains ownership of).
57 : ///
58 : /// \param Args - The argument list, which may be used to alter the default
59 : /// toolchain, for example in the presence of -m32 or -m64.
60 : ///
61 : /// \param ArchName - The architecture to return a toolchain for, or 0 if
62 : /// unspecified. This will only ever be non-zero for hosts which support a
63 : /// driver driver.
64 :
65 : // FIXME: Pin down exactly what the HostInfo is allowed to use Args
66 : // for here. Currently this is for -m32 / -m64 defaulting.
67 : virtual ToolChain *CreateToolChain(const ArgList &Args,
68 : const char *ArchName=0) const = 0;
69 : };
70 :
71 : const HostInfo *createAuroraUXHostInfo(const Driver &D,
72 : const llvm::Triple& Triple);
73 : const HostInfo *createDarwinHostInfo(const Driver &D,
74 : const llvm::Triple& Triple);
75 : const HostInfo *createOpenBSDHostInfo(const Driver &D,
76 : const llvm::Triple& Triple);
77 : const HostInfo *createFreeBSDHostInfo(const Driver &D,
78 : const llvm::Triple& Triple);
79 : const HostInfo *createDragonFlyHostInfo(const Driver &D,
80 : const llvm::Triple& Triple);
81 : const HostInfo *createLinuxHostInfo(const Driver &D,
82 : const llvm::Triple& Triple);
83 : const HostInfo *createUnknownHostInfo(const Driver &D,
84 : const llvm::Triple& Triple);
85 :
86 : } // end namespace driver
87 : } // end namespace clang
88 :
89 : #endif
Generated: 2010-02-10 01:31 by zcov