summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2019-07-23 17:49:45 +0000
committerNico Weber <nicolasweber@gmx.de>2019-07-23 17:49:45 +0000
commit37944130f950ffb8f14cb7fe1a8ba3ca0d9f097c (patch)
treeea062784f3fb1882b725678fa27d939bbabf871a /clang/unittests/Format/FormatTest.cpp
parent93f505942c8091a3ebbf6f08764635f19dc79095 (diff)
downloadbcm5719-llvm-37944130f950ffb8f14cb7fe1a8ba3ca0d9f097c.tar.gz
bcm5719-llvm-37944130f950ffb8f14cb7fe1a8ba3ca0d9f097c.zip
clang-format: Fix namespace end comments for namespaces with attributes and macros.
Fixes PR39247. While here, also make C++20 `namespace A::inline B::inline C` nested inline namespaced definitions work. Before: #define DEPRECATE_WOOF [[deprecated("meow")]] namespace DEPRECATE_WOOF woof { void f() {} } // namespace DEPRECATE_WOOFwoof namespace [[deprecated("meow")]] woof { void f() {} } // namespace [[deprecated("meow")]]woof namespace woof::inline bark { void f() {} } // namespace woof::inlinebark Now: #define DEPRECATE_WOOF [[deprecated("meow")]] namespace DEPRECATE_WOOF woof { void f() {} } // namespace woof namespace [[deprecated("meow")]] woof { void f() {} } // namespace woof namespace woof::inline bark { void f() {} } // namespace woof::inline bark (In addition to the fixed namespace end comments, also note the correct indent of the namespace contents.) Differential Revision: https://reviews.llvm.org/D65125 llvm-svn: 366831
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 463b9213a04..614e81e333a 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1782,6 +1782,21 @@ TEST_F(FormatTest, FormatsNamespaces) {
"void f() { f(); }\n"
"}",
LLVMWithNoNamespaceFix);
+ verifyFormat("namespace N::inline D {\n"
+ "class A {};\n"
+ "void f() { f(); }\n"
+ "}",
+ LLVMWithNoNamespaceFix);
+ verifyFormat("namespace N::inline D::E {\n"
+ "class A {};\n"
+ "void f() { f(); }\n"
+ "}",
+ LLVMWithNoNamespaceFix);
+ verifyFormat("namespace [[deprecated(\"foo[bar\")]] some_namespace {\n"
+ "class A {};\n"
+ "void f() { f(); }\n"
+ "}",
+ LLVMWithNoNamespaceFix);
verifyFormat("/* something */ namespace some_namespace {\n"
"class A {};\n"
"void f() { f(); }\n"
OpenPOWER on IntegriCloud