diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-12-18 02:43:17 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-12-18 02:43:17 +0000 |
commit | f2d8b9f967a1ab53ee9fdbcc3ac0a4ee0a83a26e (patch) | |
tree | a895667ec91441fddff4eba4440bd06b6195c9fc /lib/Driver/Tools.cpp | |
parent | dd5614b18cbe4c528b0589b4ba722346bdb9fcce (diff) |
Add -dwarf-debug-flags, which provides a way to embed the cc1 level options used
to compile a translation unit into the debug info for that file.
- Used by parts of Darwin build process to check compiler flags, etc.
- <rdar://problem/7256886> clang does not emit AT_APPLE_flags
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91661 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r-- | lib/Driver/Tools.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 55008e3bbb..d3c1b310ed 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1109,6 +1109,20 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath(C, "clang")); + + // Optionally embed the -cc1 level arguments into the debug info, for build + // analysis. + if (getToolChain().UseDwarfDebugFlags()) { + llvm::SmallString<256> Flags; + Flags += Exec; + for (unsigned i = 0, e = CmdArgs.size(); i != e; ++i) { + Flags += " "; + Flags += CmdArgs[i]; + } + CmdArgs.push_back("-dwarf-debug-flags"); + CmdArgs.push_back(Args.MakeArgString(Flags.str())); + } + Dest.addCommand(new Command(JA, *this, Exec, CmdArgs)); // Explicitly warn that these options are unsupported, even though |