aboutsummaryrefslogtreecommitdiff
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.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 8ff62ae2..c7d11e6 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1699,6 +1699,9 @@ void CompilerInvocationBase::GenerateCodeGenArgs(const CodeGenOptions &Opts,
GenerateArg(Consumer, OPT_ftime_report_EQ, "per-pass-run");
else
GenerateArg(Consumer, OPT_ftime_report);
+
+ if (Opts.TimePassesJson)
+ GenerateArg(Consumer, OPT_ftime_report_json);
}
if (Opts.PrepareForLTO && !Opts.PrepareForThinLTO)
@@ -2000,12 +2003,13 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
: llvm::codegenoptions::DebugTemplateNamesKind::Mangled);
}
- if (const Arg *A = Args.getLastArg(OPT_ftime_report, OPT_ftime_report_EQ)) {
+ if (const Arg *A = Args.getLastArg(OPT_ftime_report, OPT_ftime_report_EQ,
+ OPT_ftime_report_json)) {
Opts.TimePasses = true;
// -ftime-report= is only for new pass manager.
- if (A->getOption().getID() == OPT_ftime_report_EQ) {
- StringRef Val = A->getValue();
+ if (const Arg *EQ = Args.getLastArg(OPT_ftime_report_EQ)) {
+ StringRef Val = EQ->getValue();
if (Val == "per-pass")
Opts.TimePassesPerRun = false;
else if (Val == "per-pass-run")
@@ -2014,6 +2018,9 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
Diags.Report(diag::err_drv_invalid_value)
<< A->getAsString(Args) << A->getValue();
}
+
+ if (Args.getLastArg(OPT_ftime_report_json))
+ Opts.TimePassesJson = true;
}
Opts.PrepareForLTO = false;