[PATCH] Add support for optimization reports.

Richard Smith richard at metafoo.co.uk
Sun Apr 13 15:56:46 PDT 2014



================
Comment at: include/clang/Basic/DiagnosticFrontendKinds.td:35-42
@@ -34,1 +34,10 @@
 
+def err_fe_backend_optimization_remark: Remark<"%0">, CatBackend,
+    InGroup<BackendOptimizationRemark>;
+def warn_fe_backend_optimization_remark: Remark<"%0">, CatBackend,
+    InGroup<BackendOptimizationRemark>;
+def remark_fe_backend_optimization_remark: Remark<"%0">, CatBackend,
+    InGroup<BackendOptimizationRemark>, DefaultRemark;
+def note_fe_backend_optimization_remark: Remark<"%0">, CatBackend,
+    InGroup<BackendOptimizationRemark>;
+
----------------
I assume that these shouldn't all be `Remark`s?

`Note`s should not have an `InGroup`.

Please put a space to the left of the `:` (this file is inconsistent on this, but spaces on both sides is the established convention elsewhere).

Are you actually using any of these except for the `remark_...` form?

================
Comment at: include/clang/Basic/DiagnosticDriverKinds.td:119-121
@@ -117,1 +118,5 @@
+  "%0 in '%1'">;
+def warn_drv_optimization_remark_missing_loc : Warning<"optimization remarks "
+  "will not show source location information (use -gline-tables-only "
+  "-gcolumn-info to enable it)">, InGroup<BackendOptimizationRemark>;
 
----------------
I think this would make more sense as a note on the diagnostic we produce, if we ever actually produce one.

================
Comment at: include/clang/Driver/Options.td:259
@@ -257,1 +258,3 @@
+  HelpText<"Report transformations performed by optimization passes whose "
+           "name matches the given POSIX regular expression.">;
 def S : Flag<["-"], "S">, Flags<[DriverOption,CC1Option]>, Group<Action_Group>,
----------------
No full stop here, please. (I think we're inconsistent on this too.)

================
Comment at: lib/Frontend/CompilerInvocation.cpp:526
@@ +525,3 @@
+    std::string RegexError;
+    Opts.OptimizationRemarkPattern = new llvm::Regex(Val);
+    if (!Opts.OptimizationRemarkPattern->isValid(RegexError)) {
----------------
It looks like this is leaked. Maybe use an `llvm::Optional<llvm::Regex>` instead?


http://reviews.llvm.org/D3226






More information about the cfe-commits mailing list