diff options
author | Alan Zhao <ayzhao@google.com> | 2025-07-22 18:50:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-22 18:50:45 -0700 |
commit | 92858528c2db534e4101b7ac6cd263ac7884764d (patch) | |
tree | 2b7db07645ea9f22ada5da79ba8a452cb961e7c4 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 11fba3591692e339aa2d683c7bcc9eef66b78b88 (diff) | |
download | llvm-92858528c2db534e4101b7ac6cd263ac7884764d.zip llvm-92858528c2db534e4101b7ac6cd263ac7884764d.tar.gz llvm-92858528c2db534e4101b7ac6cd263ac7884764d.tar.bz2 |
[clang][timers][stats] Add a flag to enable timers in the stats file (#149946)
As reported in #138173, enabling `-ftime-report` adds pass timing info
to the stats file if `-stats-file` is specified. This was determined to
be WAI. However, if one intentionally wants to put timer information in
the stats file, using `-ftime-report` may lead to a lot of logspam (that
can't be removed by directing stderr to `/dev/null` as that would also
redirect compiler errors). To address this, this PR adds a flag
`-stats-file-timers` that adds timer data to the stats file without
outputting to stderr.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 3a36250..ab4384a 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -2013,8 +2013,8 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, : llvm::codegenoptions::DebugTemplateNamesKind::Mangled); } - if (const Arg *A = Args.getLastArg(OPT_ftime_report, OPT_ftime_report_EQ, - OPT_ftime_report_json)) { + if (Args.hasArg(OPT_ftime_report, OPT_ftime_report_EQ, OPT_ftime_report_json, + OPT_stats_file_timers)) { Opts.TimePasses = true; // -ftime-report= is only for new pass manager. @@ -2026,7 +2026,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, Opts.TimePassesPerRun = true; else Diags.Report(diag::err_drv_invalid_value) - << A->getAsString(Args) << A->getValue(); + << EQ->getAsString(Args) << EQ->getValue(); } if (Args.getLastArg(OPT_ftime_report_json)) |