HeaderGuardCheck.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  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. #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_HEADERGUARDCHECK_H
  9. #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_HEADERGUARDCHECK_H
  10. #include "../utils/HeaderGuard.h"
  11. namespace clang::tidy::llvm_check {
  12. /// Finds and fixes header guards that do not adhere to LLVM style.
  13. /// For the user-facing documentation see:
  14. /// http://clang.llvm.org/extra/clang-tidy/checks/llvm/header-guard.html
  15. /// The check supports these options:
  16. /// - `HeaderFileExtensions`: a semicolon-separated list of filename
  17. /// extensions of header files (The filename extension should not contain
  18. /// "." prefix). ";h;hh;hpp;hxx" by default.
  19. ///
  20. /// For extension-less header files, using an empty string or leaving an
  21. /// empty string between ";" if there are other filename extensions.
  22. class LLVMHeaderGuardCheck : public utils::HeaderGuardCheck {
  23. public:
  24. LLVMHeaderGuardCheck(StringRef Name, ClangTidyContext *Context);
  25. bool shouldSuggestEndifComment(StringRef Filename) override { return false; }
  26. std::string getHeaderGuard(StringRef Filename, StringRef OldGuard) override;
  27. };
  28. } // namespace clang::tidy::llvm_check
  29. #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_HEADERGUARDCHECK_H