clang-tools 3.8.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

HeaderGuardCheck.h
Go to the documentation of this file.
1 //===--- HeaderGuardCheck.h - clang-tidy ------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_HEADER_GUARD_CHECK_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_HEADER_GUARD_CHECK_H
12
13 #include "../utils/HeaderGuard.h"
14
15 namespace clang {
16 namespace tidy {
17 namespace llvm {
18
19 /// Finds and fixes header guards that do not adhere to LLVM style.
20 class LLVMHeaderGuardCheck : public HeaderGuardCheck {
21 public:
22 LLVMHeaderGuardCheck(StringRef Name, ClangTidyContext *Context)
23 : HeaderGuardCheck(Name, Context) {}
24 bool shouldSuggestEndifComment(StringRef Filename) override { return false; }
25 bool shouldFixHeaderGuard(StringRef Filename) override;
26 std::string getHeaderGuard(StringRef Filename, StringRef OldGuard) override;
27 };
28
29 } // namespace llvm
30 } // namespace tidy
31 } // namespace clang
32
33 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_HEADER_GUARD_CHECK_H
Name
StringHandle Name
Definition: PreprocessorTracker.cpp:525
clang::tidy::llvm::LLVMHeaderGuardCheck::LLVMHeaderGuardCheck
LLVMHeaderGuardCheck(StringRef Name, ClangTidyContext *Context)
Definition: HeaderGuardCheck.h:22
clang::tidy::llvm::LLVMHeaderGuardCheck::getHeaderGuard
std::string getHeaderGuard(StringRef Filename, StringRef OldGuard) override
Get the canonical header guard for a file.
Definition: HeaderGuardCheck.cpp:20
Filename
std::string Filename
Filename as a string.
Definition: IncludeOrderCheck.cpp:36
clang::tidy::llvm::LLVMHeaderGuardCheck::shouldSuggestEndifComment
bool shouldSuggestEndifComment(StringRef Filename) override
Returns true if the checker should suggest inserting a trailing comment on the #endif of the header g...
Definition: HeaderGuardCheck.h:24
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:124
clang::tidy::HeaderGuardCheck
Finds and fixes header guards.
Definition: HeaderGuard.h:19
clang::tidy::llvm::LLVMHeaderGuardCheck
Finds and fixes header guards that do not adhere to LLVM style.
Definition: HeaderGuardCheck.h:20
clang::tidy::llvm::LLVMHeaderGuardCheck::shouldFixHeaderGuard
bool shouldFixHeaderGuard(StringRef Filename) override
Returns true if the checker should suggest changing an existing header guard to the string returned b...
Definition: HeaderGuardCheck.cpp:16