]> granicus.if.org Git - clang/commitdiff
ccc: Darwin/Link also runs dsymutil in one very particular situation.
authorDaniel Dunbar <daniel@zuster.org>
Tue, 13 Jan 2009 06:44:28 +0000 (06:44 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 13 Jan 2009 06:44:28 +0000 (06:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62154 91177308-0d34-0410-b5e6-96231b3b80d8

tools/ccc/ccclib/Arguments.py
tools/ccc/ccclib/Tools.py

index 9352a9912d49556b952af610d86d9aed0d270ba7..687c8acdccb04339f1c2be1e6e8d94fcb83ca9f3 100644 (file)
@@ -689,6 +689,8 @@ class OptionParser:
         self.addOption(JoinedOption('-d', group=self.dGroup))
 
         self.gGroup = OptionGroup('-g')
+        self.gstabsOption = self.addOption(JoinedOption('-gstabs', self.gGroup))
+        self.g0Option = self.addOption(JoinedOption('-g0', self.gGroup))
         self.g3Option = self.addOption(JoinedOption('-g3', self.gGroup))
         self.gOption = self.addOption(JoinedOption('-g', self.gGroup))
 
index 1140dee6b4ecab73edacb207efd2a8c24886e85b..989b472b72e48571848b11d9b32a7ce856b72ead 100644 (file)
@@ -879,10 +879,17 @@ class Darwin_X86_LinkTool(Tool):
         jobs.addJob(Jobs.Command(self.toolChain.getProgramPath('collect2'), 
                                  cmd_args))
 
-        # FIXME: We need to add a dsymutil job here in some particular
-        # cases (basically whenever we have a c-family input we are
-        # compiling, I think). Find out why this is the condition, and
-        # implement. See link_command spec for more details.
+        if (arglist.getLastArg(arglist.parser.gGroup) and
+            not arglist.getLastArg(arglist.parser.gstabsOption) and
+            not arglist.getLastArg(arglist.parser.g0Option)):
+            # FIXME: This is gross, but matches gcc. The test only
+            # considers the suffix (not the -x type), and then only of the
+            # first input.
+            inputSuffix = os.path.splitext(arglist.getValue(inputs[0].baseInput))[1]        
+            if inputSuffix in ('.c','.cc','.C','.cpp','.cp',
+                               '.c++','.cxx','.CPP','.m','.mm'):
+                jobs.addJob(Jobs.Command('dsymutil', 
+                                         arglist.renderAsInput(output)))
 
 class LipoTool(Tool):
     def __init__(self):