[PATCH] D14354: Add new compiler flag to enable the generation of dwarf accelerator tables

Tamas Berghammer via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 5 10:43:53 PST 2015


tberghammer updated this revision to Diff 39385.
tberghammer added a comment.

Add a test (I have no experience writing clang tests so please let me know if I approach is wrong)


http://reviews.llvm.org/D14354

Files:
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp
  test/Driver/dwarf-accel.c

Index: test/Driver/dwarf-accel.c
===================================================================
--- /dev/null
+++ test/Driver/dwarf-accel.c
@@ -0,0 +1,6 @@
+// Check that -gdwarf-accel-tables requests the emission of the accelerator tables
+//
+// RUN: %clang -target x86_64-unknown-linux-gnu -gdwarf-accel-tables -c -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK < %t %s
+//
+// CHECK: -dwarf-accel-tables=Enable
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3876,6 +3876,14 @@
     CmdArgs.push_back("-split-dwarf=Enable");
   }
 
+  // -gdwarf-accel-tables should turn on -g and enable the genereation of the
+  // dwarf acceleration tables in the backend.
+  if (Args.hasArg(options::OPT_gdwarf_accel_tables)) {
+    DebugInfoKind = CodeGenOptions::LimitedDebugInfo;
+    CmdArgs.push_back("-backend-option");
+    CmdArgs.push_back("-dwarf-accel-tables=Enable");
+  }
+
   // After we've dealt with all combinations of things that could
   // make DebugInfoKind be other than None or DebugLineTablesOnly,
   // figure out if we need to "upgrade" it to standalone debug info.
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1161,6 +1161,7 @@
 def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group<g_flags_Group>;
 def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group<g_flags_Group>;
 def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group<g_flags_Group>;
+def gdwarf_accel_tables : Flag<["-"], "gdwarf-accel-tables">, Group<g_flags_Group>;
 def gmodules : Flag <["-"], "gmodules">, Group<f_Group>,
   HelpText<"Generate debug info with external references to clang modules"
            " or precompiled headers">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14354.39385.patch
Type: text/x-patch
Size: 1874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151105/5214486c/attachment.bin>


More information about the cfe-commits mailing list