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

Daniel Jasper djasper at google.com
Sun Mar 30 23:35:16 PDT 2014


  A few comments, but otherwise this looks good.

  Thank you for working on this. Do you have commit access?


================
Comment at: lib/Format/UnwrappedLineParser.h:88
@@ -87,3 +87,3 @@
   void parseIfThenElse();
-  void parseForOrWhileLoop();
+  void parseForOrWhileOrForEachLoop();
   void parseDoWhile();
----------------
I don't see any reason to rename this. ForEachLoops are for loops (which also include range-based for loops).

================
Comment at: lib/Format/UnwrappedLineParser.cpp:663
@@ -659,1 +662,3 @@
+      return;
+    }
   default:
----------------
Don't fall through implicitly, add "break;".

================
Comment at: lib/Format/UnwrappedLineParser.cpp:1051
@@ -1046,1 +1050,3 @@
+          FormatTok->IsForEachMacro) &&
+         "'for' or 'while' or foreach macro expected");
   nextToken();
----------------
Nit: 'for', 'while' or foreach macro expected.


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



More information about the cfe-commits mailing list