diff options
author | Kevin Enderby <enderby@apple.com> | 2011-12-22 19:31:58 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2011-12-22 19:31:58 +0000 |
commit | 292dc080e06ca46097f300968138140c620faf55 (patch) | |
tree | b23d5e0dd43c2bd9a8724ba6613f1dc9c949109f /clang/lib/Driver/Tools.cpp | |
parent | 025c58fc15f2d80218bf23f30a170a4ce6b22a26 (diff) | |
download | bcm5719-llvm-292dc080e06ca46097f300968138140c620faf55.tar.gz bcm5719-llvm-292dc080e06ca46097f300968138140c620faf55.zip |
Last part of support for generating dwarf for assembly source files. This gets
the clang driver to enable this when assembling a .s file. rdar://9275556
llvm-svn: 147167
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index d99b4f2fced..7ee4b4c126b 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -2501,7 +2501,32 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA, // Ignore explicit -force_cpusubtype_ALL option. (void) Args.hasArg(options::OPT_force__cpusubtype__ALL); - // FIXME: Add -g support, once we have it. + // Same as Clang::ConstructJob() we special case debug options to only pass + // -g to clang. I guess if it is wrong there then it is wrong here too :) . + Args.ClaimAllArgs(options::OPT_g_Group); + if (Arg *A = Args.getLastArg(options::OPT_g_Group)) + if (!A->getOption().matches(options::OPT_g0)) { + CmdArgs.push_back("-g"); + } + + // Optionally embed the -cc1as level arguments into the debug info, for build + // analysis. + if (getToolChain().UseDwarfDebugFlags()) { + ArgStringList OriginalArgs; + for (ArgList::const_iterator it = Args.begin(), + ie = Args.end(); it != ie; ++it) + (*it)->render(Args, OriginalArgs); + + llvm::SmallString<256> Flags; + const char *Exec = getToolChain().getDriver().getClangProgramPath(); + Flags += Exec; + for (unsigned i = 0, e = OriginalArgs.size(); i != e; ++i) { + Flags += " "; + Flags += OriginalArgs[i]; + } + CmdArgs.push_back("-dwarf-debug-flags"); + CmdArgs.push_back(Args.MakeArgString(Flags.str())); + } // FIXME: Add -static support, once we have it. |