summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-08-06 14:15:41 +0000
committerDaniel Jasper <djasper@google.com>2014-08-06 14:15:41 +0000
commit78b1949950439959ecfd9185a13e42886dd712a2 (patch)
treef8cb432f5ceb88d8b0e33f0fbaf3b25a7384aa39 /clang/unittests/Format/FormatTest.cpp
parentce5377afa0b74e1b972aa7d215487125648dec97 (diff)
downloadbcm5719-llvm-78b1949950439959ecfd9185a13e42886dd712a2.tar.gz
bcm5719-llvm-78b1949950439959ecfd9185a13e42886dd712a2.zip
clang-format: Correct SBPO_Always-behavior after function-like keywords
Before: auto f (int x) -> decltype(x) { return sizeof(x); } int g () noexcept(someCall ()); static_assert(sizeof(char) == 1, "Your compiler is broken"); After: auto f (int x) -> decltype (x) { return sizeof (x); } int g () noexcept (someCall ()); static_assert (sizeof (char) == 1, "Your compiler is broken"); This fixes llvm.org/PR20559. Patch by Roman Kashitsyn, thank you! llvm-svn: 214969
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 318f5b4a7cd..bd55c9ef219 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -7544,6 +7544,13 @@ TEST_F(FormatTest, ConfigurableSpaceBeforeParens) {
" break;\n"
"}", NoSpace);
verifyFormat("auto i = std::make_unique<int>(5);", NoSpace);
+ verifyFormat("size_t x = sizeof(x);", NoSpace);
+ verifyFormat("auto f(int x) -> decltype(x);", NoSpace);
+ verifyFormat("int f(T x) noexcept(x.create());", NoSpace);
+ verifyFormat("alignas(128) char a[128];", NoSpace);
+ verifyFormat("size_t x = alignof(MyType);", NoSpace);
+ verifyFormat("static_assert(sizeof(char) == 1, \"Impossible!\");", NoSpace);
+ verifyFormat("int f() throw(Deprecated);", NoSpace);
FormatStyle Space = getLLVMStyle();
Space.SpaceBeforeParens = FormatStyle::SBPO_Always;
@@ -7581,6 +7588,13 @@ TEST_F(FormatTest, ConfigurableSpaceBeforeParens) {
"#endif",
Space);
verifyFormat("auto i = std::make_unique<int> (5);", Space);
+ verifyFormat("size_t x = sizeof (x);", Space);
+ verifyFormat("auto f (int x) -> decltype (x);", Space);
+ verifyFormat("int f (T x) noexcept (x.create ());", Space);
+ verifyFormat("alignas (128) char a[128];", Space);
+ verifyFormat("size_t x = alignof (MyType);", Space);
+ verifyFormat("static_assert (sizeof (char) == 1, \"Impossible!\");", Space);
+ verifyFormat("int f () throw (Deprecated);", Space);
}
TEST_F(FormatTest, ConfigurableSpacesInParentheses) {
OpenPOWER on IntegriCloud