]> granicus.if.org Git - clang/commitdiff
ccc: Honor -ccc-clang for generic GCC toolchain.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 29 Jan 2009 06:12:22 +0000 (06:12 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 29 Jan 2009 06:12:22 +0000 (06:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63277 91177308-0d34-0410-b5e6-96231b3b80d8

tools/ccc/ccclib/ToolChain.py
tools/ccc/ccclib/Tools.py

index 564b6173faccc29db3873bde38b797f526a0f0a6..73b0127e1448f7f77fece25019a70c1b12d81d4a 100644 (file)
@@ -205,9 +205,10 @@ class Generic_GCC_ToolChain(ToolChain):
     def __init__(self, driver):
         super(Generic_GCC_ToolChain, self).__init__(driver)
         cc = Tools.GCC_CompileTool()
+        self.clangTool = Tools.Clang_CompileTool(self)
         self.toolMap = {
             Phases.PreprocessPhase : Tools.GCC_PreprocessTool(),
-            Phases.AnalyzePhase : Tools.Clang_CompileTool(self),
+            Phases.AnalyzePhase : self.clangTool,
             Phases.SyntaxOnlyPhase : cc,
             Phases.EmitLLVMPhase : cc,
             Phases.CompilePhase : cc,
@@ -218,4 +219,18 @@ class Generic_GCC_ToolChain(ToolChain):
 
     def selectTool(self, action):
         assert isinstance(action, Phases.JobAction)
+
+        if self.driver.cccClang:
+            if (action.inputs[0].type in (Types.CType, Types.CTypeNoPP,
+                                          Types.ObjCType, Types.ObjCTypeNoPP) and
+                (isinstance(action.phase, Phases.PreprocessPhase) or
+                 isinstance(action.phase, Phases.CompilePhase) or
+                 isinstance(action.phase, Phases.SyntaxOnlyPhase) or
+                 isinstance(action.phase, Phases.EmitLLVMPhase))):
+                return self.clangTool
+            elif (action.inputs[0].type in (Types.CHeaderType, Types.CHeaderNoPPType,
+                                            Types.ObjCHeaderType, Types.ObjCHeaderNoPPType) and
+                  isinstance(action.phase, Phases.PrecompilePhase)):
+                return self.clangTool
+
         return self.toolMap[action.phase.__class__]
index 62720624cb1c142c93463e3755a20da4a58e857f..a24255c652f63fc4520263f66279d2c326d52add 100644 (file)
@@ -247,12 +247,14 @@ class Clang_CompileTool(Tool):
                           not arglist.getLastArg(arglist.parser.staticOption) and
                           not arglist.getLastArg(arglist.parser.m_dynamicNoPicOption)))
 
-            archName = arglist.getValue(arch)
-            if (archName == 'x86_64' or 
-                picEnabled):
-                cmd_args.append('--relocation-model=pic')
-            elif not arglist.getLastArg(arglist.parser.m_dynamicNoPicOption):
-                cmd_args.append('--relocation-model=static')
+            # FIXME: This needs to tie into a platform hook.
+            if arch:
+                archName = arglist.getValue(arch)
+                if (archName == 'x86_64' or 
+                    picEnabled):
+                    cmd_args.append('--relocation-model=pic')
+                elif not arglist.getLastArg(arglist.parser.m_dynamicNoPicOption):
+                    cmd_args.append('--relocation-model=static')
 
             if arglist.getLastArg(arglist.parser.f_timeReportOption):
                 cmd_args.append('--time-passes')