ccc: Introduce ToolChains for mapping Actions to Tools which can
perform them.
- A ToolChain is a coherent set of tools use in a compilation
process. The idea is that a ToolChain holds roughly the information
(specs, search paths, etc.) that is in a single gcc binary.
- The default ToolChain is selected by the host and will generally
correspond to what the default system compiler would do. However,
this can be over-riden for a variety of purposes, for example the
by the driver driver or for testing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62021 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/ccc/ccclib/HostInfo.py b/tools/ccc/ccclib/HostInfo.py
index 507ac69..5f68149 100644
--- a/tools/ccc/ccclib/HostInfo.py
+++ b/tools/ccc/ccclib/HostInfo.py
@@ -1,10 +1,12 @@
+import ToolChain
+
class HostInfo(object):
"""HostInfo - Config information about a particular host which may
interact with driver behavior. This can be very different from the
target(s) of a particular driver invocation."""
- def __init__(self):
- pass
+ def __init__(self, driver):
+ self.driver = driver
def getArchName(self):
abstract
@@ -18,6 +20,9 @@
def useDriverDriver(self):
return True
+ def getToolChain(self):
+ return ToolChain.Darwin_ToolChain(self.driver)
+
class DarwinPPCHostInfo(DarwinHostInfo):
def getArchName(self):
return 'ppc'
@@ -39,14 +44,14 @@
bits = driver.getHostBits()
if machine == 'i386':
if bits == '32':
- return DarwinX86HostInfo()
+ return DarwinX86HostInfo(driver)
if bits == '64':
- return DarwinX86_64HostInfo()
+ return DarwinX86_64HostInfo(driver)
elif machine == 'ppc':
if bits == '32':
- return DarwinPPCHostInfo()
+ return DarwinPPCHostInfo(driver)
if bits == '64':
- return DarwinPPC_64HostInfo()
+ return DarwinPPC_64HostInfo(driver)
raise RuntimeError,'Unrecognized Darwin platform: %r:%r' % (machine, bits)
@@ -59,8 +64,11 @@
def useDriverDriver(self):
return False
+ def getToolChain(self):
+ return ToolChain.Generic_GCC_ToolChain(self.driver)
+
def getUnknownHostInfo(driver):
- return UnknownHostInfo()
+ return UnknownHostInfo(driver)
####
@@ -76,4 +84,4 @@
return handler(driver)
driver.warning('Unknown host %r, using generic host information.' % system)
- return UnknownHostInfo()
+ return UnknownHostInfo(driver)