aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorBrian Gesiak <modocache@gmail.com>2019-10-18 16:59:02 +0000
committerBrian Gesiak <modocache@gmail.com>2019-10-18 16:59:02 +0000
commite43eb432de21ed58e59e9fa7514750b901396916 (patch)
tree4dd68a386993d4140e229476dc0478414d4fc99a /unittests
parentf51ad847cd578b30ea6cc9b8dd3863c164f5ab46 (diff)
[Format] Add format check for throwing negative numbers
Summary: The code `throw -1;` is currently formatted by clang-format as `throw - 1;`. This diff adds a fix for this edge case and a test to check for this in the future. For context, I am looking into a related bug in the clang-formatting of coroutine keywords: `co_yield -1;` is also reformatted in this manner as `co_yield - 1;`. A later diff will add these changes and tests for the `co_yield` and `co_return` keywords. Patch by Jonathan Thomas (jonathoma)! Reviewers: modocache, sammccall, Quuxplusone Reviewed By: sammccall Subscribers: cfe-commits Tags: #clang-format, #clang Differential Revision: https://reviews.llvm.org/D69144 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375258 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Format/FormatTest.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 19269b2418..e0ebef1f7c 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -6912,6 +6912,7 @@ TEST_F(FormatTest, UnderstandsUnaryOperators) {
verifyFormat("alignof(char);", getGoogleStyle());
verifyFormat("return -1;");
+ verifyFormat("throw -1;");
verifyFormat("switch (a) {\n"
"case -1:\n"
" break;\n"