summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
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
commit7f704320b058f7217847ee0e599f64e2ce50447c (patch)
tree7927411ba9c4e5c8f9764637bb5bbc3b7b156d67 /clang/unittests/Format/FormatTest.cpp
parent80fe5cffd2eef46ebd19aac6d8c6f2c3f9b4290f (diff)
downloadbcm5719-llvm-7f704320b058f7217847ee0e599f64e2ce50447c.tar.gz
bcm5719-llvm-7f704320b058f7217847ee0e599f64e2ce50447c.zip
[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 llvm-svn: 375258
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 19269b24186..e0ebef1f7ce 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/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"
OpenPOWER on IntegriCloud