clang-tools 17.0.0git
HeaderGuardCheck.h
Go to the documentation of this file.
1//===--- HeaderGuardCheck.h - clang-tidy ------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_HEADERGUARDCHECK_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_HEADERGUARDCHECK_H
11
12#include "../utils/HeaderGuard.h"
13
15
16/// Finds and fixes header guards that do not adhere to LLVM style.
17/// For the user-facing documentation see:
18/// http://clang.llvm.org/extra/clang-tidy/checks/llvm/header-guard.html
19/// The check supports these options:
20/// - `HeaderFileExtensions`: a semicolon-separated list of filename
21/// extensions of header files (The filename extension should not contain
22/// "." prefix). ";h;hh;hpp;hxx" by default.
23///
24/// For extension-less header files, using an empty string or leaving an
25/// empty string between ";" if there are other filename extensions.
27public:
28 LLVMHeaderGuardCheck(StringRef Name, ClangTidyContext *Context);
29
30 bool shouldSuggestEndifComment(StringRef Filename) override { return false; }
31 std::string getHeaderGuard(StringRef Filename, StringRef OldGuard) override;
32};
33
34} // namespace clang::tidy::llvm_check
35
36#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_HEADERGUARDCHECK_H
std::string Filename
Filename as a string.
Token Name
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Finds and fixes header guards that do not adhere to LLVM style.
std::string getHeaderGuard(StringRef Filename, StringRef OldGuard) override
Gets the canonical header guard for a file.
bool shouldSuggestEndifComment(StringRef Filename) override
Returns true if the check should suggest inserting a trailing comment on the #endif of the header gua...
Finds and fixes header guards.
Definition: HeaderGuard.h:25