r195267 - Set default Dwarf Version for -gline-tables-only on Darwin to 2.

Manman Ren manman.ren at gmail.com
Wed Nov 20 12:22:15 PST 2013


Author: mren
Date: Wed Nov 20 14:22:14 2013
New Revision: 195267

URL: http://llvm.org/viewvc/llvm-project?rev=195267&view=rev
Log:
Set default Dwarf Version for -gline-tables-only on Darwin to 2.

We are still using Dwarf Version 2 for Darwin systems, make it consistent
with -gline-tables-only.

This should fix an internal buildbot.

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/debug-options.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=195267&r1=195266&r2=195267&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Nov 20 14:22:14 2013
@@ -2600,13 +2600,18 @@ void Clang::ConstructJob(Compilation &C,
                       D.CCLogDiagnosticsFilename : "-");
   }
 
-  // Use the last option from "-g" group. "-gline-tables-only"
-  // is preserved, all other debug options are substituted with "-g".
+  // Use the last option from "-g" group. "-gline-tables-only" and "-gdwarf-x"
+  // are preserved, all other debug options are substituted with "-g".
   Args.ClaimAllArgs(options::OPT_g_Group);
   if (Arg *A = Args.getLastArg(options::OPT_g_Group)) {
-    if (A->getOption().matches(options::OPT_gline_tables_only))
+    if (A->getOption().matches(options::OPT_gline_tables_only)) {
+      // FIXME: we should support specifying dwarf version with
+      // -gline-tables-only.
       CmdArgs.push_back("-gline-tables-only");
-    else if (A->getOption().matches(options::OPT_gdwarf_2))
+      // Default is dwarf-2 for darwin.
+      if (getToolChain().getTriple().isOSDarwin())
+        CmdArgs.push_back("-gdwarf-2");
+    } else if (A->getOption().matches(options::OPT_gdwarf_2))
       CmdArgs.push_back("-gdwarf-2");
     else if (A->getOption().matches(options::OPT_gdwarf_3))
       CmdArgs.push_back("-gdwarf-3");

Modified: cfe/trunk/test/Driver/debug-options.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-options.c?rev=195267&r1=195266&r2=195267&view=diff
==============================================================================
--- cfe/trunk/test/Driver/debug-options.c (original)
+++ cfe/trunk/test/Driver/debug-options.c Wed Nov 20 14:22:14 2013
@@ -35,6 +35,8 @@
 //
 // RUN: %clang -### -c -gline-tables-only %s 2>&1 \
 // RUN:             | FileCheck -check-prefix=GLTO_ONLY %s
+// RUN: %clang -### -c -gline-tables-only %s -target x86_64-apple-darwin 2>&1 \
+// RUN:             | FileCheck -check-prefix=GLTO_ONLY_DARWIN %s
 // RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-linux-gnu 2>&1 \
 // RUN:             | FileCheck -check-prefix=G_ONLY %s
 // RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-apple-darwin 2>&1 \
@@ -66,6 +68,12 @@
 // GLTO_ONLY: "-gline-tables-only"
 // GLTO_ONLY-NOT: "-g"
 //
+// GLTO_ONLY_DARWIN: "-cc1"
+// GLTO_ONLY_DARWIN-NOT: "-g"
+// GLTO_ONLY_DARWIN: "-gline-tables-only"
+// GLTO_ONLY_DARWIN: "-gdwarf-2"
+// GLTO_ONLY_DARWIN-NOT: "-g"
+//
 // G_ONLY: "-cc1"
 // G_ONLY-NOT: "-gline-tables-only"
 // G_ONLY: "-g"





More information about the cfe-commits mailing list