blob: 23f12fd6860a8217dc52d958770cea3f4c856cbd [file] [log] [blame]
Olivier Deprezf4ef2d02021-04-20 13:36:24 +02001//===--- 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
14namespace clang {
15namespace tidy {
16namespace llvm_check {
17
18/// Finds and fixes header guards that do not adhere to LLVM style.
19/// For the user-facing documentation see:
20/// http://clang.llvm.org/extra/clang-tidy/checks/llvm-header-guard.html
21/// The check supports these options:
22/// - `HeaderFileExtensions`: a semicolon-separated list of filename
23/// extensions of header files (The filename extension should not contain
24/// "." prefix). ";h;hh;hpp;hxx" by default.
25///
26/// For extension-less header files, using an empty string or leaving an
27/// empty string between ";" if there are other filename extensions.
28class LLVMHeaderGuardCheck : public utils::HeaderGuardCheck {
29public:
30 LLVMHeaderGuardCheck(StringRef Name, ClangTidyContext *Context);
31
32 bool shouldSuggestEndifComment(StringRef Filename) override { return false; }
33 std::string getHeaderGuard(StringRef Filename, StringRef OldGuard) override;
34};
35
36} // namespace llvm_check
37} // namespace tidy
38} // namespace clang
39
40#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_HEADERGUARDCHECK_H