[PATCH] Use a manipulator to add a value to the current diagnostic flag.

Richard Smith richard at metafoo.co.uk
Tue Apr 22 12:48:24 PDT 2014


LGTM with some tiny tweaks, thanks!

BRANCH
  add-optimization-remarks

================
Comment at: include/clang/Basic/Diagnostic.h:696
@@ +695,3 @@
+  /// \brief Set the value associated to this diagnostic flag.
+  void setFlagNameValue(StringRef V) { FlagNameValue = V.str(); }
+
----------------
The `.str()` should not be necessary here.

================
Comment at: include/clang/Basic/Diagnostic.h:1016
@@ +1015,3 @@
+struct AddFlagValue {
+  AddFlagValue(StringRef V) : Val(V) {}
+  StringRef Val;
----------------
Please make this constructor `explicit`.

================
Comment at: include/clang/Basic/Diagnostic.h:1123
@@ -1107,3 +1122,3 @@
   CurDiagID = DiagID;
-  FlagNameValue = Val.str();
+  FlagNameValue.erase();
   return DiagnosticBuilder(this);
----------------
`clear` is a more common way of spelling this than `erase`.

http://reviews.llvm.org/D3453

REPLY HANDLER ACTIONS
  Reply to comment, or !reject, !abandon, !reclaim, !resign, !rethink, !unsubscribe.






More information about the cfe-commits mailing list