[PATCH] [clang-tidy] Add a generic header guard checker + LLVM implementation.
Benjamin Kramer
benny.kra at gmail.com
Tue Aug 12 07:55:59 PDT 2014
Hi alexfh, klimek, djasper,
The implementation is split into a generic part and a LLVM-specific part.
Other codebases can implement it with their own style. The specific features
supported are:
- Verification (and fixing) of header guards against a style based on the file path
- Automatic insertion of header guards for headers that are missing them
- A warning when the header guard doesn't enable our fancy header guard optimization
(e.g. when there's an include preceeding the guard)
- Automatic insertion of a comment with the guard name after #endif.
For the LLVM style we disable #endif comments for now, they're not very common
in the codebase. We also only flag headers in the include directories, there
doesn't seem to be a common style outside.
http://reviews.llvm.org/D4867
Files:
clang-tidy/CMakeLists.txt
clang-tidy/llvm/CMakeLists.txt
clang-tidy/llvm/HeaderGuardCheck.cpp
clang-tidy/llvm/HeaderGuardCheck.h
clang-tidy/llvm/LLVMTidyModule.cpp
clang-tidy/utils/CMakeLists.txt
clang-tidy/utils/HeaderGuard.cpp
clang-tidy/utils/HeaderGuard.h
unittests/clang-tidy/LLVMModuleTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4867.12400.patch
Type: text/x-patch
Size: 16069 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140812/761ce9c6/attachment.bin>
More information about the cfe-commits
mailing list