[PATCH] Add support for optimization reports.
Richard Smith
richard at metafoo.co.uk
Mon Apr 14 17:14:16 PDT 2014
================
Comment at: lib/Frontend/CompilerInvocation.cpp:526
@@ +525,3 @@
+ std::string RegexError;
+ Opts.OptimizationRemarkPattern = new llvm::Regex(Val);
+ if (!Opts.OptimizationRemarkPattern->isValid(RegexError)) {
----------------
Diego Novillo wrote:
> Richard Smith wrote:
> > It looks like this is leaked. Maybe use an `llvm::Optional<llvm::Regex>` instead?
> I tried but llvm::Regex has an explicitly deleted constructor. I'm not sure how to deal with that, so I ended up using regular pointer semantics.
`llvm::Optional` shouldn't call the `llvm::Regex` default constructor.
================
Comment at: lib/CodeGen/CodeGenAction.cpp:433
@@ +432,3 @@
+ return;
+ ComputeDiagRemarkID(Severity, backend_optimization_remark, DiagID);
+ break;
----------------
It looks like we get here (and potentially use the error/warning forms of the remark diagnostic) if the diagnostic severity isn't `DS_Remark`. I don't think this is what we want -- maybe the severity check in `OptimizationRemarkHandler` should be an assert?
================
Comment at: include/clang/Basic/DiagnosticFrontendKinds.td:40-42
@@ +39,5 @@
+def note_fe_backend_optimization_remark : Note<"%0">, CatBackend;
+def note_fe_backend_optimization_remark_missing_loc : Note<"optimization "
+ "remarks cannot show source location information (use -gline-tables-only "
+ "-gcolumn-info to enable it)">;
+
----------------
Maybe better phrased as:
"use -gline-tables-only -gcolumn-info to track source location information for this optimization remark"
http://reviews.llvm.org/D3226
More information about the cfe-commits
mailing list