diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-05-29 08:10:34 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-05-29 08:10:34 +0000 |
commit | dda3a7f91442ad6472927a59f1740f1db001e3f2 (patch) | |
tree | dfa86dbb8e686d13e8683cd38fe6c3a951620a29 /clang/lib/Driver/Tools.cpp | |
parent | e8ccc1134bf2b5597517ffce0e27d1c4f72bf9b7 (diff) | |
download | bcm5719-llvm-dda3a7f91442ad6472927a59f1740f1db001e3f2.tar.gz bcm5719-llvm-dda3a7f91442ad6472927a59f1740f1db001e3f2.zip |
Make Clang driver pass the last option from -g group to the compiler.
Leave a better fixme for different debug info flags
llvm-svn: 157602
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 1769077f8e3..752a58b9c43 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -1839,15 +1839,22 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, D.CCLogDiagnosticsFilename : "-"); } - // Special case debug options to only pass -g to clang. This is - // wrong. + // Use the last option from "-g" group. "-gline-tables-only" is + // preserved, all other debug options are substituted with "-g". + // FIXME: We should eventually do the following: + // 1) collapse gdb and dwarf variations to -g (as we do now); + // 2) support things like -gtoggle; + // 3) ignore flag options like -gstrict-dwarf or -grecord-gcc-switches; + // 4) produce a driver error on unsupported formats + // (-gstabs, -gcoff, -gvms etc.) Args.ClaimAllArgs(options::OPT_g_Group); - if (Arg *A = Args.getLastArg(options::OPT_g_Group)) - if (!A->getOption().matches(options::OPT_g0)) { + if (Arg *A = Args.getLastArg(options::OPT_g_Group)) { + if (A->getOption().matches(options::OPT_gline_tables_only)) { + CmdArgs.push_back("-gline-tables-only"); + } else if (!A->getOption().matches(options::OPT_g0)) { CmdArgs.push_back("-g"); } - if (Args.hasArg(options::OPT_gline_tables_only)) - CmdArgs.push_back("-gline-tables-only"); + } Args.AddAllArgs(CmdArgs, options::OPT_ffunction_sections); Args.AddAllArgs(CmdArgs, options::OPT_fdata_sections); |