summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-06-11 08:38:19 +0000
committerDaniel Jasper <djasper@google.com>2015-06-11 08:38:19 +0000
commit229628b39e1eaedc9870824786ee32ca8cd0c5c2 (patch)
treeb9b7fe4f48d48887699bbf0056d43310ec21512b /clang/unittests/Format/FormatTest.cpp
parente0e228a380585e538073ded404c7e009b9458f42 (diff)
downloadbcm5719-llvm-229628b39e1eaedc9870824786ee32ca8cd0c5c2.tar.gz
bcm5719-llvm-229628b39e1eaedc9870824786ee32ca8cd0c5c2.zip
clang-format: Don't add spaces in foreach macro definition.
Before clang-format would e.g. add a space into #define Q_FOREACH(x, y) which turns this into a non-function-like macro. Patch by Strager Neds, thank you! llvm-svn: 239513
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index c4aa712ba1d..5b3980bdb5f 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -616,6 +616,18 @@ TEST_F(FormatTest, ForEachLoops) {
" BOOST_FOREACH (Item *item, itemlist) {}\n"
" UNKNOWN_FORACH(Item * item, itemlist) {}\n"
"}");
+
+ // As function-like macros.
+ verifyFormat("#define foreach(x, y)\n"
+ "#define Q_FOREACH(x, y)\n"
+ "#define BOOST_FOREACH(x, y)\n"
+ "#define UNKNOWN_FOREACH(x, y)\n");
+
+ // Not as function-like macros.
+ verifyFormat("#define foreach (x, y)\n"
+ "#define Q_FOREACH (x, y)\n"
+ "#define BOOST_FOREACH (x, y)\n"
+ "#define UNKNOWN_FOREACH (x, y)\n");
}
TEST_F(FormatTest, FormatsWhileLoop) {
OpenPOWER on IntegriCloud