Driver: Change -dwarf-debug-flags option to pass the original command line
arguments after translation, instead of the -cc1 level arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105476 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 78f2d70..4ab32ed 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1462,11 +1462,16 @@
// Optionally embed the -cc1 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;
Flags += Exec;
- for (unsigned i = 0, e = CmdArgs.size(); i != e; ++i) {
+ for (unsigned i = 0, e = OriginalArgs.size(); i != e; ++i) {
Flags += " ";
- Flags += CmdArgs[i];
+ Flags += OriginalArgs[i];
}
CmdArgs.push_back("-dwarf-debug-flags");
CmdArgs.push_back(Args.MakeArgString(Flags.str()));
diff --git a/test/Driver/darwin-debug-flags.c b/test/Driver/darwin-debug-flags.c
index 7ce6137..6f24527 100644
--- a/test/Driver/darwin-debug-flags.c
+++ b/test/Driver/darwin-debug-flags.c
@@ -2,10 +2,8 @@
// <rdar://problem/7256886>
// CHECK: !1 = metadata !{
-// CHECK: -cc1
-// CHECK: -triple i386-apple-darwin9
-// CHECK: -g
-// CHECK: -Os
+// CHECK: -mmacosx-version-min=10.5.0
+// CHECK: -g -Os
// CHECK: [ DW_TAG_compile_unit ]
int x;