[PATCH] D72793: [clang-format] Expand the SpacesAroundConditions option to include catch statements
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 19 08:04:10 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGea2be452542c: [clang-format] Expand the SpacesAroundConditions option to include catch… (authored by MyDeveloperDay).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72793/new/
https://reviews.llvm.org/D72793
Files:
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp
Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -14980,6 +14980,7 @@
verifyFormat("while ( a )\n return;", Spaces);
verifyFormat("while ( (a && b) )\n return;", Spaces);
verifyFormat("do {\n} while ( 1 != 0 );", Spaces);
+ verifyFormat("try {\n} catch ( const std::exception & ) {\n}", Spaces);
// Check that space on the left of "::" is inserted as expected at beginning
// of condition.
verifyFormat("while ( ::func() )\n return;", Spaces);
Index: clang/lib/Format/TokenAnnotator.cpp
===================================================================
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -2597,7 +2597,7 @@
/// otherwise.
static bool isKeywordWithCondition(const FormatToken &Tok) {
return Tok.isOneOf(tok::kw_if, tok::kw_for, tok::kw_while, tok::kw_switch,
- tok::kw_constexpr);
+ tok::kw_constexpr, tok::kw_catch);
}
bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72793.238994.patch
Type: text/x-patch
Size: 1160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200119/98ac7f10/attachment-0001.bin>
More information about the cfe-commits
mailing list