[PATCH] Add support for foreach macros to clang-format

Daniel Jasper djasper at google.com
Mon Mar 10 07:08:49 PDT 2014


  I don't think using regular expressions is the right way to go here:
  - We'll want to precisely control which macros are a "foreach". Otherwise, it is too likely to accidentally come up with a method name that matches the regex.
  - Regular expressions have a performance impact, especially in the way they are used here (not precomputed once per token).

  I would argue for making this a (e.g. comma-separated) list of macros, which gets parsed into the identifier table used to lookup most of the other identifiers.


================
Comment at: docs/ClangFormatStyleOptions.rst:314
@@ -302,1 +313,3 @@
     keywords (``for/if/while...``).
+  * ``SBPO_ControlStatementsAndForEachMacros`` (in configuration:
+    ``ControlStatementsAndForEachMacros``)
----------------
Do we really want to treat those separate from control statements? I don't see a good/valid reason for doing so...


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



More information about the cfe-commits mailing list