diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-02 15:26:16 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-02 15:26:16 +0000 |
commit | 1f0754bf761f7d4910348ce3aba867d34473bceb (patch) | |
tree | f05cd17da0b008143d20f71881d0624ab56b1b8f /unittests/Format/FormatTest.cpp | |
parent | 9a64fb5690ba2b53c761def068e20ec64c584d96 (diff) |
Understand unary operators after "return" and "case".
This fixes llvm.org/PR14746.
Before: return - 1;
After: return -1;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171389 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 58712ef38f..22da93ebe3 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -646,6 +646,12 @@ TEST_F(FormatTest, UnderstandsUnaryOperators) { verifyFormat("b ? -a : c;"); verifyFormat("n * sizeof char16;"); verifyFormat("sizeof(char);"); + + verifyFormat("return -1;"); + verifyFormat("switch (a) {\n" + "case -1:\n" + " break;\n" + "}"); } TEST_F(FormatTest, UndestandsOverloadedOperators) { |