clang-tools 22.0.0git
|
Finds and fixes header guards. More...
#include <HeaderGuard.h>
Public Member Functions | |
HeaderGuardCheck (StringRef Name, ClangTidyContext *Context) | |
void | registerPPCallbacks (const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) override |
std::string | sanitizeHeaderGuard (StringRef Guard) |
Ensure that the provided header guard is a non-reserved identifier. | |
virtual std::string | formatEndIf (StringRef HeaderGuard) |
Returns true if the check should suggest inserting a trailing comment / on the #endif of the header guard. | |
virtual std::string | getHeaderGuard (StringRef Filename, StringRef OldGuard=StringRef())=0 |
Gets the canonical header guard for a file. |
Finds and fixes header guards.
Definition at line 18 of file HeaderGuard.h.
|
inline |
Definition at line 20 of file HeaderGuard.h.
Referenced by clang::tidy::llvm_check::LLVMHeaderGuardCheck::LLVMHeaderGuardCheck().
|
virtual |
Returns true if the check should suggest inserting a trailing comment / on the #endif of the header guard.
It will use the same name as / returned by HeaderGuardCheck::getHeaderGuard. virtual bool shouldSuggestEndifComment(StringRef Filename); / Returns true if the check should suggest changing an existing header / guard to the string returned by HeaderGuardCheck::getHeaderGuard. virtual bool shouldFixHeaderGuard(StringRef Filename); / Returns true if the check should add a header guard to the file / if it has none. virtual bool shouldSuggestToAddHeaderGuard(StringRef Filename); / Returns a replacement for the #endif line with a comment mentioning / HeaderGuard
. The replacement should start with endif.
Definition at line 293 of file HeaderGuard.cpp.
|
pure virtual |
Gets the canonical header guard for a file.
Implemented in clang::tidy::llvm_check::LLVMHeaderGuardCheck.
|
override |
Definition at line 272 of file HeaderGuard.cpp.
std::string clang::tidy::utils::HeaderGuardCheck::sanitizeHeaderGuard | ( | StringRef | Guard | ) |
Ensure that the provided header guard is a non-reserved identifier.
Definition at line 278 of file HeaderGuard.cpp.