[PATCH] D24791: Use checktime when reloading vim buffer after applying clang-rename

2016-09-21 Thread Kai Wolf via cfe-commits
NewProggie created this revision.
NewProggie added a subscriber: cfe-commits.

After applying `clang-rename` to a vim buffer (using `clang-rename.py` as part 
of the vim integration) the buffer gets reloaded using `bufdo`. This solution 
is suboptimal, since syntax highlighting is turned off for performance reasons 
and never turned on, after all changes to the source file have been applied. 

A better solution to this is using `checktime`. It is exactly designed for this 
kind of task and doesn't have the syntax highlighting issue.

https://reviews.llvm.org/D24791

Files:
  clang-rename/tool/clang-rename.py

Index: clang-rename/tool/clang-rename.py
===
--- clang-rename/tool/clang-rename.py
+++ clang-rename/tool/clang-rename.py
@@ -54,7 +54,7 @@
 print stderr
 
 # Reload all buffers in Vim.
-vim.command("bufdo edit")
+vim.command("checktime")
 
 
 if __name__ == '__main__':


Index: clang-rename/tool/clang-rename.py
===
--- clang-rename/tool/clang-rename.py
+++ clang-rename/tool/clang-rename.py
@@ -54,7 +54,7 @@
 print stderr
 
 # Reload all buffers in Vim.
-vim.command("bufdo edit")
+vim.command("checktime")
 
 
 if __name__ == '__main__':
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24791: Use checktime when reloading vim buffer after applying clang-rename

2016-09-25 Thread Kai Wolf via cfe-commits
NewProggie added a comment.

In https://reviews.llvm.org/D24791#551662, @omtcyfz wrote:

> @NewProggie do you have commit access or do you want me to land this patch 
> for you?


I don't have commit access. Please, land it for me. Glad, you've accepted my 
patch.


https://reviews.llvm.org/D24791



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D16765: [Clang-Format] Add option for spacing between function parameters

2016-02-01 Thread Kai Wolf via cfe-commits
NewProggie created this revision.
NewProggie added reviewers: poiru, djasper, klimek.
NewProggie added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

This patch adds an option to remove the blank after comma between several 
function parameters. The default value is still to keep the blank.

http://reviews.llvm.org/D16765

Files:
  docs/ClangFormatStyleOptions.rst
  include/clang/Format/Format.h
  lib/Format/Format.cpp
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -10954,6 +10954,19 @@
   verifyFormat("A>();", Spaces);
 }
 
+TEST_F(FormatTest, SpacesBetweenFunctionParameters) {
+  FormatStyle Spaces = getLLVMStyle();
+  Spaces.SpacesBetweenFunctionParameters = false;
+
+  verifyFormat("void foo(int a);", Spaces);
+  verifyFormat("void foo(int a,double b);", Spaces);
+  verifyFormat("void foo(int a,double b,char c);", Spaces);
+
+  Spaces.SpacesBetweenFunctionParameters = true;
+  verifyFormat("void foo(int a, double b);", Spaces);
+  verifyFormat("void foo(int a, double b, char c);", Spaces);
+}
+
 TEST_F(FormatTest, TripleAngleBrackets) {
   verifyFormat("f<<<1, 1>>>();");
   verifyFormat("f<<<1, 1, 1, s>>>();");
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -2074,7 +2074,7 @@
   if (Right.is(TT_OverloadedOperatorLParen))
 return Style.SpaceBeforeParens == FormatStyle::SBPO_Always;
   if (Left.is(tok::comma))
-return true;
+return Style.SpacesBetweenFunctionParameters;
   if (Right.is(tok::comma))
 return false;
   if (Right.isOneOf(TT_CtorInitializerColon, TT_ObjCBlockLParen))
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -322,6 +322,8 @@
 IO.mapOptional("SpaceInEmptyParentheses", Style.SpaceInEmptyParentheses);
 IO.mapOptional("SpacesBeforeTrailingComments",
Style.SpacesBeforeTrailingComments);
+IO.mapOptional("SpacesBetweenFunctionParameters",
+   Style.SpacesBetweenFunctionParameters);
 IO.mapOptional("SpacesInAngles", Style.SpacesInAngles);
 IO.mapOptional("SpacesInContainerLiterals",
Style.SpacesInContainerLiterals);
@@ -516,6 +518,7 @@
   LLVMStyle.ObjCSpaceBeforeProtocolList = true;
   LLVMStyle.PointerAlignment = FormatStyle::PAS_Right;
   LLVMStyle.SpacesBeforeTrailingComments = 1;
+  LLVMStyle.SpacesBetweenFunctionParameters = true;
   LLVMStyle.Standard = FormatStyle::LS_Cpp11;
   LLVMStyle.UseTab = FormatStyle::UT_Never;
   LLVMStyle.ReflowComments = true;
@@ -561,6 +564,7 @@
   GoogleStyle.ObjCSpaceBeforeProtocolList = false;
   GoogleStyle.PointerAlignment = FormatStyle::PAS_Left;
   GoogleStyle.SpacesBeforeTrailingComments = 2;
+  GoogleStyle.SpacesBetweenFunctionParameters = true;
   GoogleStyle.Standard = FormatStyle::LS_Auto;
 
   GoogleStyle.PenaltyReturnTypeOnItsOwnLine = 200;
Index: include/clang/Format/Format.h
===
--- include/clang/Format/Format.h
+++ include/clang/Format/Format.h
@@ -539,6 +539,9 @@
   /// commonly have different usage patterns and a number of special cases.
   unsigned SpacesBeforeTrailingComments;
 
+  /// \b If \c true, spaces will be inserted between function parameters.
+  bool SpacesBetweenFunctionParameters;
+
   /// \brief If \c true, spaces will be inserted after '<' and before '>' in
   /// template argument lists
   bool SpacesInAngles;
@@ -657,6 +660,8 @@
SpaceBeforeParens == R.SpaceBeforeParens &&
SpaceInEmptyParentheses == R.SpaceInEmptyParentheses &&
SpacesBeforeTrailingComments == R.SpacesBeforeTrailingComments &&
+   SpacesBetweenFunctionParameters ==
+   R.SpacesBetweenFunctionParameters &&
SpacesInAngles == R.SpacesInAngles &&
SpacesInContainerLiterals == R.SpacesInContainerLiterals &&
SpacesInCStyleCastParentheses == R.SpacesInCStyleCastParentheses &&
Index: docs/ClangFormatStyleOptions.rst
===
--- docs/ClangFormatStyleOptions.rst
+++ docs/ClangFormatStyleOptions.rst
@@ -611,6 +611,9 @@
   This does not affect trailing block comments (``/**/`` - comments) as those
   commonly have different usage patterns and a number of special cases.
 
+**SpacesBetweenFunctionParameters** (``bool``)
+  If ``true``, a space will be inserted between several function parameters.
+
 **SpacesInAngles** (``bool``)
   If ``true``, spaces will be inserted after '<' and before '>' in
   template argument lists
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://