From 454cb70f9470dc37d0c0646012877d64fb1e73d7 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Fri, 3 May 2013 14:50:50 +0000 Subject: [PATCH] Add space between ; and (. Before: for (int i = 0;(i < 10); ++i) {} After: for (int i = 0; (i < 10); ++i) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181020 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Format/TokenAnnotator.cpp | 2 +- unittests/Format/FormatTest.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 6fa79813fa..185a45d43d 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -1048,7 +1048,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, return Line.Type == LT_ObjCDecl || Left.isOneOf(tok::kw_if, tok::kw_for, tok::kw_while, tok::kw_switch, tok::kw_return, tok::kw_catch, tok::kw_new, - tok::kw_delete); + tok::kw_delete, tok::semi); } if (Left.is(tok::at) && Right.FormatTok.Tok.getObjCKeywordID() != tok::objc_not_keyword) diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index abb2b5819c..45c8e81dc7 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -302,6 +302,7 @@ TEST_F(FormatTest, FormatsForLoop) { verifyFormat("for (;;) {\n" " f();\n" "}"); + verifyFormat("for (int i = 0; (i < 10); ++i) {\n}"); verifyFormat( "for (std::vector::iterator I = UnwrappedLines.begin(),\n" -- 2.40.0