summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2014-10-15 12:18:35 +0000
committerAlexander Kornienko <alexfh@google.com>2014-10-15 12:18:35 +0000
commit81d4f939bc031ee0710bc2d41d0e10648b4ff95b (patch)
tree94ba80ea7d35612ea1d1246e0447d6934a83ae36 /clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp
parentbebe0c6918e96f4f9e7fb21d6edf95e5753096aa (diff)
downloadbcm5719-llvm-81d4f939bc031ee0710bc2d41d0e10648b4ff95b.tar.gz
bcm5719-llvm-81d4f939bc031ee0710bc2d41d0e10648b4ff95b.zip
Fix llvm-header-guard check.
Summary: This patch makes the check work better for LLVM code: * always fix existing #endif comments * use one space before the comment (+allow customization for other styles) Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5795 llvm-svn: 219789
Diffstat (limited to 'clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp')
-rw-r--r--clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp b/clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp
index a35f29ab560..92f9cc3f8ca 100644
--- a/clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp
+++ b/clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp
@@ -103,9 +103,19 @@ TEST(LLVMHeaderGuardCheckTest, FixHeaderGuards) {
"#endif\n",
"include/clang/bar.h", /*ExpectedWarnings=*/1));
+ // Fix incorrect #endif comments even if we shouldn't add new ones.
EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n"
"#define LLVM_ADT_FOO_H\n"
- "#endif // LLVM_ADT_FOO_H\n",
+ "#endif // LLVM_ADT_FOO_H\n",
+ runHeaderGuardCheck("#ifndef FOO\n"
+ "#define FOO\n"
+ "#endif // FOO\n",
+ "include/llvm/ADT/foo.h",
+ /*ExpectedWarnings=*/1));
+
+ EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n"
+ "#define LLVM_ADT_FOO_H\n"
+ "#endif // LLVM_ADT_FOO_H\n",
runHeaderGuardCheckWithEndif("#ifndef FOO\n"
"#define FOO\n"
"#endif\n",
@@ -114,7 +124,7 @@ TEST(LLVMHeaderGuardCheckTest, FixHeaderGuards) {
EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n"
"#define LLVM_ADT_FOO_H\n"
- "#endif // LLVM_ADT_FOO_H\n",
+ "#endif // LLVM_ADT_FOO_H\n",
runHeaderGuardCheckWithEndif("#ifndef LLVM_ADT_FOO_H\n"
"#define LLVM_ADT_FOO_H\n"
"#endif // LLVM_H\n",
@@ -141,7 +151,7 @@ TEST(LLVMHeaderGuardCheckTest, FixHeaderGuards) {
EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n"
"#define LLVM_ADT_FOO_H\n"
- "#endif // LLVM_ADT_FOO_H\n",
+ "#endif // LLVM_ADT_FOO_H\n",
runHeaderGuardCheckWithEndif("#ifndef LLVM_ADT_FOO_H_\n"
"#define LLVM_ADT_FOO_H_\n"
"#endif // LLVM\n",
OpenPOWER on IntegriCloud