summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp38
1 files changed, 9 insertions, 29 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 8a7e879d07b..7667c109556 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -393,37 +393,17 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
}
- if (Args.hasArg(OPT_gline_tables_only)) {
- Opts.setDebugInfo(CodeGenOptions::DebugLineTablesOnly);
- } else if (Args.hasArg(OPT_g_Flag) || Args.hasArg(OPT_gdwarf_2) ||
- Args.hasArg(OPT_gdwarf_3) || Args.hasArg(OPT_gdwarf_4)) {
- bool Default = false;
- // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
- // Darwin and FreeBSD default to standalone/full debug info.
- if (llvm::Triple(TargetOpts.Triple).isOSDarwin() ||
- llvm::Triple(TargetOpts.Triple).isOSFreeBSD())
- Default = true;
-
- if (Args.hasFlag(OPT_fstandalone_debug, OPT_fno_standalone_debug, Default))
- Opts.setDebugInfo(CodeGenOptions::FullDebugInfo);
- else
- Opts.setDebugInfo(CodeGenOptions::LimitedDebugInfo);
- }
+ if (Arg *A = Args.getLastArg(OPT_debug_info_kind_EQ)) {
+ Opts.setDebugInfo(
+ llvm::StringSwitch<CodeGenOptions::DebugInfoKind>(A->getValue())
+ .Case("line-tables-only", CodeGenOptions::DebugLineTablesOnly)
+ .Case("limited", CodeGenOptions::LimitedDebugInfo)
+ .Case("standalone", CodeGenOptions::FullDebugInfo));
+ }
+ Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 0, Diags);
Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info);
- if (Args.hasArg(OPT_gcodeview)) {
- Opts.EmitCodeView = true;
- Opts.DwarfVersion = 0;
- } else if (Opts.getDebugInfo() != CodeGenOptions::NoDebugInfo) {
- // Default Dwarf version is 4 if we are generating debug information.
- Opts.DwarfVersion = 4;
- }
+ Opts.EmitCodeView = Args.hasArg(OPT_gcodeview);
Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file);
- if (Args.hasArg(OPT_gdwarf_2))
- Opts.DwarfVersion = 2;
- else if (Args.hasArg(OPT_gdwarf_3))
- Opts.DwarfVersion = 3;
- else if (Args.hasArg(OPT_gdwarf_4))
- Opts.DwarfVersion = 4;
Opts.DebugTypeExtRefs = Args.hasArg(OPT_dwarf_ext_refs);
if (const Arg *A =
OpenPOWER on IntegriCloud