summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2014-06-24 17:02:17 +0000
committerDiego Novillo <dnovillo@google.com>2014-06-24 17:02:17 +0000
commit913690c7bc1baf27d6a170d5d266023f04d790fb (patch)
tree198cded6b5e0f3c2aed812904aa681cdb00bb42b /clang/lib/Frontend/CompilerInvocation.cpp
parent56653fdada178e97bbdaf9682cd691b8c3184d93 (diff)
downloadbcm5719-llvm-913690c7bc1baf27d6a170d5d266023f04d790fb.tar.gz
bcm5719-llvm-913690c7bc1baf27d6a170d5d266023f04d790fb.zip
Add new debug kind LocTrackingOnly.
Summary: This new debug emission kind supports emitting line location information in all instructions, but stops code generation from emitting debug info to the final output. This mode is useful when the backend wants to track source locations during code generation, but it does not want to produce debug info. This is currently used by optimization remarks (-Rpass, -Rpass-missed and -Rpass-analysis). When one of the -Rpass flags is used, the front end will enable location tracking, only if no other debug option is enabled. To prevent debug information from being generated, a new debug info kind LocTrackingOnly causes DIBuilder::createCompileUnit() to not emit the llvm.dbg.cu annotation. This blocks final code generation from generating debug info in the back end. Depends on D4234. Reviewers: echristo, dblaikie Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4235 llvm-svn: 211610
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 71138861d06..e4cee346858 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -550,18 +550,30 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
}
Opts.DependentLibraries = Args.getAllArgValues(OPT_dependent_lib);
+ bool NeedLocTracking = false;
- if (Arg *A = Args.getLastArg(OPT_Rpass_EQ))
+ if (Arg *A = Args.getLastArg(OPT_Rpass_EQ)) {
Opts.OptimizationRemarkPattern =
GenerateOptimizationRemarkRegex(Diags, Args, A);
+ NeedLocTracking = true;
+ }
- if (Arg *A = Args.getLastArg(OPT_Rpass_missed_EQ))
+ if (Arg *A = Args.getLastArg(OPT_Rpass_missed_EQ)) {
Opts.OptimizationRemarkMissedPattern =
GenerateOptimizationRemarkRegex(Diags, Args, A);
+ NeedLocTracking = true;
+ }
- if (Arg *A = Args.getLastArg(OPT_Rpass_analysis_EQ))
+ if (Arg *A = Args.getLastArg(OPT_Rpass_analysis_EQ)) {
Opts.OptimizationRemarkAnalysisPattern =
GenerateOptimizationRemarkRegex(Diags, Args, A);
+ NeedLocTracking = true;
+ }
+
+ // If the user requested one of the flags in the -Rpass family, make sure
+ // that the backend tracks source location information.
+ if (NeedLocTracking && Opts.getDebugInfo() == CodeGenOptions::NoDebugInfo)
+ Opts.setDebugInfo(CodeGenOptions::LocTrackingOnly);
return Success;
}
OpenPOWER on IntegriCloud