aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorVictor Kingi <victor.kingi@arm.com>2023-08-30 12:45:23 +0000
committerVictor Kingi <victor.kingi@arm.com>2023-08-31 15:41:16 +0000
commit12da8ef0e318cf1e05c1380de7b98bc5cfa51f42 (patch)
treec93a3045e9976ffbb6fc231528f450a1eec17c34 /flang/lib/Frontend/CompilerInvocation.cpp
parent380c5da98efa62920e9fbf3aa9a4fa8add236fb9 (diff)
downloadllvm-12da8ef0e318cf1e05c1380de7b98bc5cfa51f42.zip
llvm-12da8ef0e318cf1e05c1380de7b98bc5cfa51f42.tar.gz
llvm-12da8ef0e318cf1e05c1380de7b98bc5cfa51f42.tar.bz2
[Flang][Driver] Add location and remark option printing to R_Group Diagnostics
For each R_Group diagnostic produced, this patch gives more information about it by printing the absolute file path, the line and column number the pass was applied to and finally the remark option that was used. Clang does the same with the exception of printing the relative path rather than absolute path. Depends on D159260. That patch adds support for backend passes while this patch adds remark options to the backend test cases. Reviewed By: awarzynski Differential Revision: https://reviews.llvm.org/D159258
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 56218cb..81bf89b 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -267,6 +267,21 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts,
diags, args, clang::driver::options::OPT_Rpass_analysis_EQ,
/*remarkOptName=*/"pass-analysis");
+ if (opts.getDebugInfo() == llvm::codegenoptions::NoDebugInfo) {
+ // If the user requested a flag that requires source locations available in
+ // the backend, make sure that the backend tracks source location
+ // information.
+ bool needLocTracking = !opts.OptRecordFile.empty() ||
+ !opts.OptRecordPasses.empty() ||
+ !opts.OptRecordFormat.empty() ||
+ opts.OptimizationRemark.hasValidPattern() ||
+ opts.OptimizationRemarkMissed.hasValidPattern() ||
+ opts.OptimizationRemarkAnalysis.hasValidPattern();
+
+ if (needLocTracking)
+ opts.setDebugInfo(llvm::codegenoptions::LocTrackingOnly);
+ }
+
if (auto *a = args.getLastArg(clang::driver::options::OPT_save_temps_EQ))
opts.SaveTempsDir = a->getValue();