[cfe-commits] r65100 - in /cfe/trunk/tools/ccc/ccclib: ToolChain.py Tools.py

Daniel Dunbar daniel at zuster.org
Thu Feb 19 17:30:38 PST 2009


Author: ddunbar
Date: Thu Feb 19 19:30:38 2009
New Revision: 65100

URL: http://llvm.org/viewvc/llvm-project?rev=65100&view=rev
Log:
ccc: Give all tools access to the toolchain they are in.
 - No functionality change.

Modified:
    cfe/trunk/tools/ccc/ccclib/ToolChain.py
    cfe/trunk/tools/ccc/ccclib/Tools.py

Modified: cfe/trunk/tools/ccc/ccclib/ToolChain.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/ToolChain.py?rev=65100&r1=65099&r2=65100&view=diff

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/ToolChain.py (original)
+++ cfe/trunk/tools/ccc/ccclib/ToolChain.py Thu Feb 19 19:30:38 2009
@@ -99,7 +99,7 @@
             Phases.PrecompilePhase : cc,
             Phases.AssemblePhase : Tools.Darwin_AssembleTool(self),
             Phases.LinkPhase : Tools.Darwin_X86_LinkTool(self),
-            Phases.LipoPhase : Tools.LipoTool(),
+            Phases.LipoPhase : Tools.LipoTool(self),
             }
 
         if archName == 'x86_64':
@@ -237,17 +237,17 @@
 
     def __init__(self, driver):
         super(Generic_GCC_ToolChain, self).__init__(driver)
-        cc = Tools.GCC_CompileTool()
+        cc = Tools.GCC_CompileTool(self)
         self.clangTool = Tools.Clang_CompileTool(self)
         self.toolMap = {
-            Phases.PreprocessPhase : Tools.GCC_PreprocessTool(),
+            Phases.PreprocessPhase : Tools.GCC_PreprocessTool(self),
             Phases.AnalyzePhase : self.clangTool,
             Phases.SyntaxOnlyPhase : cc,
             Phases.EmitLLVMPhase : cc,
             Phases.CompilePhase : cc,
-            Phases.PrecompilePhase : Tools.GCC_PrecompileTool(),
-            Phases.AssemblePhase : Tools.GCC_AssembleTool(),
-            Phases.LinkPhase : Tools.GCC_LinkTool(),
+            Phases.PrecompilePhase : Tools.GCC_PrecompileTool(self),
+            Phases.AssemblePhase : Tools.GCC_AssembleTool(self),
+            Phases.LinkPhase : Tools.GCC_LinkTool(self),
             }
 
     def selectTool(self, action):

Modified: cfe/trunk/tools/ccc/ccclib/Tools.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Tools.py?rev=65100&r1=65099&r2=65100&view=diff

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Tools.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Tools.py Thu Feb 19 19:30:38 2009
@@ -13,8 +13,9 @@
     eFlagsPipedOutput = 1 << 1
     eFlagsIntegratedCPP = 1 << 2
 
-    def __init__(self, name, flags = 0):
+    def __init__(self, name, toolChain, flags = 0):
         self.name = name
+        self.toolChain = toolChain
         self.flags = flags
 
     def acceptsPipedInput(self):
@@ -79,8 +80,8 @@
         jobs.addJob(Jobs.Command('gcc', cmd_args))
 
 class GCC_PreprocessTool(GCC_Common_Tool):
-    def __init__(self):
-        super(GCC_PreprocessTool, self).__init__('gcc (cpp)',
+    def __init__(self, toolChain):
+        super(GCC_PreprocessTool, self).__init__('gcc (cpp)', toolChain,
                                                  (Tool.eFlagsPipedInput |
                                                   Tool.eFlagsPipedOutput))
 
@@ -88,8 +89,8 @@
         return ['-E']
 
 class GCC_CompileTool(GCC_Common_Tool):
-    def __init__(self):
-        super(GCC_CompileTool, self).__init__('gcc (cc1)',
+    def __init__(self, toolChain):
+        super(GCC_CompileTool, self).__init__('gcc (cc1)', toolChain,
                                               (Tool.eFlagsPipedInput |
                                                Tool.eFlagsPipedOutput |
                                                Tool.eFlagsIntegratedCPP))
@@ -98,8 +99,8 @@
         return ['-S']
 
 class GCC_PrecompileTool(GCC_Common_Tool):
-    def __init__(self):
-        super(GCC_PrecompileTool, self).__init__('gcc (pch)',
+    def __init__(self, toolChain):
+        super(GCC_PrecompileTool, self).__init__('gcc (pch)', toolChain,
                                                  (Tool.eFlagsPipedInput |
                                                   Tool.eFlagsIntegratedCPP))
 
@@ -107,24 +108,23 @@
         return []
 
 class GCC_AssembleTool(GCC_Common_Tool):
-    def __init__(self):
+    def __init__(self, toolChain):
         # Assume that gcc will do any magic necessary to let the
         # assembler take piped input.
-        super(GCC_AssembleTool, self).__init__('gcc (as)',
+        super(GCC_AssembleTool, self).__init__('gcc (as)', toolChain,
                                                Tool.eFlagsPipedInput)
 
     def getGCCExtraArgs(self):
         return ['-c']
 
 class GCC_LinkTool(GCC_Common_Tool):
-    def __init__(self):
-        super(GCC_LinkTool, self).__init__('gcc (ld)')
+    def __init__(self, toolChain):
+        super(GCC_LinkTool, self).__init__('gcc (ld)', toolChain)
 
 class Darwin_AssembleTool(Tool):
     def __init__(self, toolChain):
-        super(Darwin_AssembleTool, self).__init__('as',
+        super(Darwin_AssembleTool, self).__init__('as', toolChain,
                                                   Tool.eFlagsPipedInput)
-        self.toolChain = toolChain
 
     def constructJob(self, phase, arch, jobs, inputs, 
                      output, outputType, arglist, linkingOutput):
@@ -167,11 +167,10 @@
 
 class Clang_CompileTool(Tool):
     def __init__(self, toolChain):
-        super(Clang_CompileTool, self).__init__('clang',
+        super(Clang_CompileTool, self).__init__('clang', toolChain,
                                    (Tool.eFlagsPipedInput |
                                     Tool.eFlagsPipedOutput |
                                     Tool.eFlagsIntegratedCPP))
-        self.toolChain = toolChain
 
     def constructJob(self, phase, arch, jobs, inputs, 
                      output, outputType, arglist, linkingOutput):
@@ -674,10 +673,9 @@
         
 class Darwin_X86_PreprocessTool(Darwin_X86_CC1Tool):
     def __init__(self, toolChain):
-        super(Darwin_X86_PreprocessTool, self).__init__('cpp',
+        super(Darwin_X86_PreprocessTool, self).__init__('cpp', toolChain,
                                                         (Tool.eFlagsPipedInput |
                                                          Tool.eFlagsPipedOutput))
-        self.toolChain = toolChain
     
     def constructJob(self, phase, arch, jobs, inputs, 
                      output, outputType, arglist, linkingOutput):
@@ -704,11 +702,10 @@
     
 class Darwin_X86_CompileTool(Darwin_X86_CC1Tool):
     def __init__(self, toolChain):
-        super(Darwin_X86_CompileTool, self).__init__('cc1',
+        super(Darwin_X86_CompileTool, self).__init__('cc1', toolChain,
                                                      (Tool.eFlagsPipedInput |
                                                       Tool.eFlagsPipedOutput |
                                                       Tool.eFlagsIntegratedCPP))
-        self.toolChain = toolChain
 
     def constructJob(self, phase, arch, jobs, inputs, 
                      output, outputType, arglist, linkingOutput):
@@ -781,8 +778,7 @@
 
 class Darwin_X86_LinkTool(Tool):
     def __init__(self, toolChain):
-        super(Darwin_X86_LinkTool, self).__init__('collect2')
-        self.toolChain = toolChain
+        super(Darwin_X86_LinkTool, self).__init__('collect2', toolChain)
 
     def getMacosxVersionTuple(self, arglist):
         arg = arglist.getLastArg(arglist.parser.m_macosxVersionMinOption)
@@ -1197,8 +1193,8 @@
                                          arglist.renderAsInput(output)))
 
 class LipoTool(Tool):
-    def __init__(self):
-        super(LipoTool, self).__init__('lipo')
+    def __init__(self, toolChain):
+        super(LipoTool, self).__init__('lipo', toolChain)
 
     def constructJob(self, phase, arch, jobs, inputs,
                      output, outputType, arglist, linkingOutput):





More information about the cfe-commits mailing list