]> granicus.if.org Git - clang/commitdiff
IR: Represent -ggnu-pubnames with a flag on the DICompileUnit.
authorPeter Collingbourne <peter@pcc.me.uk>
Tue, 12 Sep 2017 21:50:41 +0000 (21:50 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Tue, 12 Sep 2017 21:50:41 +0000 (21:50 +0000)
This allows the flag to be persisted through to LTO.

Differential Revision: https://reviews.llvm.org/D37655

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313078 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Options.td
include/clang/Frontend/CodeGenOptions.def
lib/CodeGen/CGDebugInfo.cpp
lib/Driver/ToolChains/Clang.cpp
lib/Frontend/CompilerInvocation.cpp
test/Driver/debug-options.c

index 4f6cbe5fd4180d7d692c797519130ae51f46ad84..4b5a9ec25f2b10119f5ac3678a1c68161eb7e8d9 100644 (file)
@@ -1596,7 +1596,7 @@ def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">, Group<g_flags_Group>;
 def gcolumn_info : Flag<["-"], "gcolumn-info">, Group<g_flags_Group>, Flags<[CoreOption]>;
 def gno_column_info : Flag<["-"], "gno-column-info">, Group<g_flags_Group>, Flags<[CoreOption]>;
 def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group<g_flags_Group>;
-def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group<g_flags_Group>;
+def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group<g_flags_Group>, Flags<[CC1Option]>;
 def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group<g_flags_Group>;
 def gmodules : Flag <["-"], "gmodules">, Group<gN_Group>,
   HelpText<"Generate debug info with external references to clang modules"
index b58a5d5725b040339149688103c72e91ccb9a5b5..ac85c73d0fca383e37dccf57f18d13f9c29ecaa1 100644 (file)
@@ -287,6 +287,9 @@ CODEGENOPT(DebugInfoForProfiling, 1, 0)
 /// Whether 3-component vector type is preserved.
 CODEGENOPT(PreserveVec3Type, 1, 0)
 
+/// Whether to emit .debug_gnu_pubnames section instead of .debug_pubnames.
+CODEGENOPT(GnuPubnames, 1, 0)
+
 #undef CODEGENOPT
 #undef ENUM_CODEGENOPT
 #undef VALUE_CODEGENOPT
index f4c84c5c63014ef8d92d3b3d75e2c7c5c6f76fdc..a052ffb617349e9ce06505de35c94c90ce2d421a 100644 (file)
@@ -562,7 +562,8 @@ void CGDebugInfo::CreateCompileUnit() {
       Producer, LO.Optimize || CGOpts.PrepareForLTO || CGOpts.EmitSummaryIndex,
       CGOpts.DwarfDebugFlags, RuntimeVers,
       CGOpts.EnableSplitDwarf ? "" : CGOpts.SplitDwarfFile, EmissionKind,
-      0 /* DWOid */, CGOpts.SplitDwarfInlining, CGOpts.DebugInfoForProfiling);
+      0 /* DWOid */, CGOpts.SplitDwarfInlining, CGOpts.DebugInfoForProfiling,
+      CGOpts.GnuPubnames);
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
index 25998627a1bbb2296b58c78417ad3344b77de109..d69ea4926f78ccdf989f265e5567d3d2342717a9 100644 (file)
@@ -2952,10 +2952,8 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
     CmdArgs.push_back("-debug-info-macro");
 
   // -ggnu-pubnames turns on gnu style pubnames in the backend.
-  if (Args.hasArg(options::OPT_ggnu_pubnames)) {
-    CmdArgs.push_back("-backend-option");
-    CmdArgs.push_back("-generate-gnu-dwarf-pub-sections");
-  }
+  if (Args.hasArg(options::OPT_ggnu_pubnames))
+    CmdArgs.push_back("-ggnu-pubnames");
 
   // -gdwarf-aranges turns on the emission of the aranges section in the
   // backend.
index f9dafbb88ea5f337e22cf9fd6bc558a4dc56d8ac..3321dac8673ad00a9c19f89aab5400d5a0bf9876 100644 (file)
@@ -564,6 +564,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
   Opts.SampleProfileFile = Args.getLastArgValue(OPT_fprofile_sample_use_EQ);
   Opts.DebugInfoForProfiling = Args.hasFlag(
       OPT_fdebug_info_for_profiling, OPT_fno_debug_info_for_profiling, false);
+  Opts.GnuPubnames = Args.hasArg(OPT_ggnu_pubnames);
 
   setPGOInstrumentor(Opts, Args, Diags);
   Opts.InstrProfileOutput =
index b4a2e909b3a3d3f64f347b3494ec8e28e535afcd..9445156f4bcfaab38d0824ceff8ba9c60eb1980f 100644 (file)
 //
 // GIGNORE-NOT: "argument unused during compilation"
 //
-// GOPT: -generate-gnu-dwarf-pub-sections
+// GOPT: -ggnu-pubnames
 //
 // GARANGE: -generate-arange-section
 //