From 8d475618089e8bb3d0e47605b236b445eaefab2d Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Wed, 9 Apr 2014 12:21:48 +0000 Subject: clang-format: Fix bug where clang-format would break the code. Before, it would turn: SomeFunction([]() { // Cool function.. return 43; }); Into this: SomeFunction([]() { // Cool function.. return 43; }); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205849 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Format/Format.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/Format/Format.cpp') diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 5367106535..4075ccdc8c 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -1121,6 +1121,10 @@ private: if (Previous.Children.size() > 1) return false; + // Cannot merge into one line if this line ends on a comment. + if (Previous.is(tok::comment)) + return false; + // We can't put the closing "}" on a line with a trailing comment. if (Previous.Children[0]->Last->isTrailingComment()) return false; -- cgit v1.2.3