[PATCH] Better macro error messages involving initializer lists

Richard Smith richard at metafoo.co.uk
Mon Jul 22 16:02:05 PDT 2013


  LGTM with a couple of tiny tweaks.


================
Comment at: lib/Lex/PPMacroExpansion.cpp:710-713
@@ +709,6 @@
+         ParenLocation != ParenEnd; ++ParenLocation) {
+      if (DB.hasMaxFixItsHints())
+        break;
+      DB << FixItHint::CreateInsertion(ParenLocation->getBegin(), "(")
+         << FixItHint::CreateInsertion(ParenLocation->getEnd(), ")");
+    }
----------------
For robustness, please check hasMaxFixItHints between adding the two fixits here. The maximum might not always be even.

================
Comment at: include/clang/Basic/Diagnostic.h:987
@@ +986,3 @@
+
+  bool hasMaxFixItsHints() const {
+    return NumFixits == DiagnosticsEngine::MaxFixItHints;
----------------
Should be "hasMaxFixItHints" presumably?


http://llvm-reviews.chandlerc.com/D986



More information about the cfe-commits mailing list