[PATCH] Fixes bug 20559 - SBPO_Always does not work for sizeof

Daniel Jasper djasper at google.com
Wed Aug 6 07:09:44 PDT 2014


Two minor comments, otherwise looks good.

================
Comment at: lib/Format/FormatToken.h:356
@@ -355,1 +355,3 @@
 
+  /// \brief Returns \c true if this is a keyword which usage looks
+  /// like a function call. E.g. sizeof, typeid, static_assert.
----------------
How about:

  /// \brief Returns \c true if this is a keyword that can be used
  /// like a function call (e.g. sizeof, typeid, ...).

================
Comment at: lib/Format/TokenAnnotator.cpp:1552
@@ -1551,2 +1551,3 @@
            (Style.SpaceBeforeParens == FormatStyle::SBPO_Always &&
-            Left.isOneOf(tok::identifier, tok::kw___attribute) &&
+            (Left.isOneOf(tok::identifier, tok::kw___attribute) ||
+             Left.isFunctionLikeKeyword()) &&
----------------
What do you think about moving kw___attribute into isFunctionLikeKeyword as well?

http://reviews.llvm.org/D4809






More information about the cfe-commits mailing list