aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-04 00:55:30 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-04 00:55:30 +0000
commit0b46e1b5389615a8d6641f4d7bf5415d29acfef3 (patch)
treeb29929be26e0aa1a3c3763dc7eae0b7dd1c697cc /lib/Driver/Tools.cpp
parent4f53b298846d720fbb906373f3f28d92f2121f35 (diff)
Driver: Handle properly calling dsymutil when source input is
preceeded by a linker input flag. - <rdar://problem/6757236> clang should make a dSYM when going straight from source to binary - This still matches gcc, but the right way to solve this would be to detect the situation we care about (we are compiling from source and linking in one step), instead of looking at the suffix of the input file. The Tool doesn't quite have enough information to do this yet, however. - Also, find the suffix correctly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68417 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r--lib/Driver/Tools.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 70daaf5a62..bbf7c9e1a6 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1446,13 +1446,23 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
Args.MakeArgString(getToolChain().GetProgramPath(C, "collect2").c_str());
Dest.addCommand(new Command(Exec, CmdArgs));
+ // Find the first non-empty base input (we want to ignore linker
+ // inputs).
+ const char *BaseInput = "";
+ for (unsigned i = 0, e = Inputs.size(); i != e; ++i) {
+ if (Inputs[i].getBaseInput()[0] != '\0') {
+ BaseInput = Inputs[i].getBaseInput();
+ break;
+ }
+ }
+
if (Args.getLastArg(options::OPT_g_Group) &&
!Args.getLastArg(options::OPT_gstabs) &&
!Args.getLastArg(options::OPT_g0)) {
// FIXME: This is gross, but matches gcc. The test only considers
// the suffix (not the -x type), and then only of the first
- // input. Awesome.
- const char *Suffix = strchr(Inputs[0].getBaseInput(), '.');
+ // source input. Awesome.
+ const char *Suffix = strrchr(BaseInput, '.');
if (Suffix && isSourceSuffix(Suffix + 1)) {
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "dsymutil").c_str());