[PATCH] D69144: [Format] Add format check for throwing negative numbers
Brian Gesiak via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 18 10:02:43 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7f704320b058: [Format] Add format check for throwing negative numbers (authored by modocache).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69144/new/
https://reviews.llvm.org/D69144
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
@@ -6912,6 +6912,7 @@
verifyFormat("alignof(char);", getGoogleStyle());
verifyFormat("return -1;");
+ verifyFormat("throw -1;");
verifyFormat("switch (a) {\n"
"case -1:\n"
" break;\n"
Index: clang/lib/Format/TokenAnnotator.cpp
===================================================================
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -1757,7 +1757,7 @@
// Use heuristics to recognize unary operators.
if (PrevToken->isOneOf(tok::equal, tok::l_paren, tok::comma, tok::l_square,
tok::question, tok::colon, tok::kw_return,
- tok::kw_case, tok::at, tok::l_brace))
+ tok::kw_case, tok::at, tok::l_brace, tok::kw_throw))
return TT_UnaryOperator;
// There can't be two consecutive binary operators.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69144.225657.patch
Type: text/x-patch
Size: 1082 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191018/c82fb26f/attachment.bin>
More information about the cfe-commits
mailing list