[clang-tidy] Replace unrecognized namespace ending comments.
Summary:
Replace unrecognized namespace ending comments. This will help in particular when a namespace ending comment is mistyped or doesn't fit the regexp for other reason, e.g.:
namespace a {
namespace b {
namespace {
} // anoynmous namespace
} // b
} // namesapce a
Reviewers: djasper
Reviewed By: djasper
Subscribers: curdeius, cfe-commits
Differential Revision: http://reviews.llvm.org/D8078
llvm-svn: 231369
diff --git a/clang-tools-extra/unittests/clang-tidy/ReadabilityModuleTest.cpp b/clang-tools-extra/unittests/clang-tidy/ReadabilityModuleTest.cpp
index 8c7007c..70e320b 100644
--- a/clang-tools-extra/unittests/clang-tidy/ReadabilityModuleTest.cpp
+++ b/clang-tools-extra/unittests/clang-tidy/ReadabilityModuleTest.cpp
@@ -75,11 +75,6 @@
runCheckOnCode<NamespaceCommentCheck>("namespace {\n"
"}\n"
"// namespace"));
- // Leave unknown comments.
- EXPECT_EQ("namespace {\n"
- "} // namespace // random text",
- runCheckOnCode<NamespaceCommentCheck>("namespace {\n"
- "} // random text"));
}
TEST(NamespaceCommentCheckTest, FixWrongComments) {
@@ -94,6 +89,11 @@
"} // namespace",
runCheckOnCode<NamespaceCommentCheck>("namespace {\n"
"} // namespace asdf"));
+ // Remove unknown comments.
+ EXPECT_EQ("namespace {\n"
+ "} // namespace",
+ runCheckOnCode<NamespaceCommentCheck>("namespace {\n"
+ "} // random text"));
}
TEST(BracesAroundStatementsCheck, IfWithComments) {