summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2014-01-07 01:19:08 +0000
committerAdrian Prantl <aprantl@apple.com>2014-01-07 01:19:08 +0000
commita763447124ba107870865b1c7ba8ad97f0cf78d8 (patch)
tree7265d3d7bb8bfc79362b21bdb1e9bd280fa98932 /clang/lib/Frontend/CompilerInvocation.cpp
parent0b8e3b2cb41e105a39b9d9b21d6ece18942581cb (diff)
downloadbcm5719-llvm-a763447124ba107870865b1c7ba8ad97f0cf78d8.tar.gz
bcm5719-llvm-a763447124ba107870865b1c7ba8ad97f0cf78d8.zip
Implement a new -fstandalone-debug option. rdar://problem/15685848
It controls everything that -flimit-debug-info used to, plus the vtable type optimization. The old -fno-limit-debug-info option is now an alias to -fstandalone-debug and vice versa. Standalone is the default on Darwin until dtrace is updated to work with non-standalone debug info (rdar://problem/15758808). Note: I kept the LimitedDebugInfo name in CodeGenOptions::DebugInfoKind because NoStandaloneDebugInfo sounded even more confusing. llvm-svn: 198655
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 3065e1769b0..dc4aad74b94 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -296,7 +296,8 @@ static void ParseCommentArgs(CommentOptions &Opts, ArgList &Args) {
}
static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
- DiagnosticsEngine &Diags) {
+ DiagnosticsEngine &Diags,
+ const TargetOptions &TargetOpts) {
using namespace options;
bool Success = true;
@@ -323,10 +324,16 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
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)) {
- if (Args.hasFlag(OPT_flimit_debug_info, OPT_fno_limit_debug_info, true))
- Opts.setDebugInfo(CodeGenOptions::LimitedDebugInfo);
- else
+ bool Default = false;
+ // Until dtrace (via CTF) can deal with distributed debug info,
+ // Darwin defaults to standalone/full debug info.
+ if (llvm::Triple(TargetOpts.Triple).isOSDarwin())
+ Default = true;
+
+ if (Args.hasFlag(OPT_fstandalone_debug, OPT_fno_standalone_debug, Default))
Opts.setDebugInfo(CodeGenOptions::FullDebugInfo);
+ else
+ Opts.setDebugInfo(CodeGenOptions::LimitedDebugInfo);
}
Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info);
Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file);
@@ -1662,8 +1669,9 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
ParseFileSystemArgs(Res.getFileSystemOpts(), *Args);
// FIXME: We shouldn't have to pass the DashX option around here
InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), *Args, Diags);
- Success = ParseCodeGenArgs(Res.getCodeGenOpts(), *Args, DashX, Diags)
- && Success;
+ ParseTargetArgs(Res.getTargetOpts(), *Args);
+ Success = ParseCodeGenArgs(Res.getCodeGenOpts(), *Args, DashX, Diags,
+ Res.getTargetOpts()) && Success;
ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), *Args);
if (DashX != IK_AST && DashX != IK_LLVM_IR) {
ParseLangArgs(*Res.getLangOpts(), *Args, DashX, Diags);
@@ -1678,8 +1686,6 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
ParsePreprocessorArgs(Res.getPreprocessorOpts(), *Args, FileMgr, Diags);
ParsePreprocessorOutputArgs(Res.getPreprocessorOutputOpts(), *Args,
Res.getFrontendOpts().ProgramAction);
- ParseTargetArgs(Res.getTargetOpts(), *Args);
-
return Success;
}
OpenPOWER on IntegriCloud