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

Roman Kashitsyn romankashicin at gmail.com
Wed Aug 6 07:19:58 PDT 2014


Commit this patch please, I have no commit access yet.

================
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.
----------------
Daniel Jasper wrote:
> How about:
> 
>   /// \brief Returns \c true if this is a keyword that can be used
>   /// like a function call (e.g. sizeof, typeid, ...).
Ok.

================
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()) &&
----------------
Daniel Jasper wrote:
> What do you think about moving kw___attribute into isFunctionLikeKeyword as well?
Good idea, thanks.

http://reviews.llvm.org/D4809






More information about the cfe-commits mailing list