[PATCH] clang-format: Fix space in for-each macro definition

Daniel Jasper djasper at google.com
Fri Jun 5 01:09:04 PDT 2015


Please use unittests/Format/FormatTest.cpp for the unit test.


================
Comment at: lib/Format/Format.cpp:1125-1127
@@ -1124,4 +1124,5 @@
 
-    if (std::find(ForEachMacros.begin(), ForEachMacros.end(),
-                  FormatTok->Tok.getIdentifierInfo()) != ForEachMacros.end())
-      FormatTok->Type = TT_ForEachMacro;
+    if (!(Tokens.size() > 0 && Tokens.back()->Tok.getIdentifierInfo() &&
+          Tokens.back()->Tok.getIdentifierInfo()->getPPKeywordID() ==
+            tok::pp_define))
+      if (std::find(ForEachMacros.begin(), ForEachMacros.end(),
----------------
Generally use clang-format. Also, why are you using two nested if conditions instead of just merging this into the other one?

http://reviews.llvm.org/D10266

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list