From 6fa7e74dea00f66315835e70cdea047ba58f7b4c Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 13 Feb 2013 04:32:57 +0000 Subject: [PATCH] Formatter: Add more cast tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175030 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/Format/FormatTest.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index a91d325b51..20667208da 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -1723,7 +1723,13 @@ TEST_F(FormatTest, FormatsCasts) { // These are not casts. verifyFormat("void f(int *) {}"); - verifyFormat("f(foo)[4];"); + verifyFormat("f(foo)->b;"); + verifyFormat("f(foo).b;"); + verifyFormat("f(foo)(b);"); + verifyFormat("f(foo)[b];"); + verifyFormat("[](foo) { return 4; }(bar)];"); + verifyFormat("(*funptr)(foo)[4];"); + verifyFormat("funptrs[4](foo)[4];"); verifyFormat("void f(int *);"); verifyFormat("void f(int *) = 0;"); verifyFormat("void f(SmallVector) {}"); @@ -1731,6 +1737,8 @@ TEST_F(FormatTest, FormatsCasts) { verifyFormat("void f(SmallVector) = 0;"); verifyFormat("void f(int i = (kValue) * kMask) {}"); verifyFormat("void f(int i = (kA * kB) & kMask) {}"); + verifyFormat("int a = sizeof(int) * b;"); + verifyFormat("int a = alignof(int) * b;"); } TEST_F(FormatTest, FormatsFunctionTypes) { -- 2.40.0