Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:20

0001 //===-- InlineFunctionDeclCheck.h -------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVMLIBC_INLINEFUNCTIONDECLCHECK_H
0010 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVMLIBC_INLINEFUNCTIONDECLCHECK_H
0011 
0012 #include "../ClangTidyCheck.h"
0013 #include "../FileExtensionsSet.h"
0014 
0015 namespace clang::tidy::llvm_libc {
0016 
0017 /// Checks that explicitly and implicitly inline functions in headers files
0018 /// are tagged with the LIBC_INLINE macro.
0019 ///
0020 /// For more information about the LIBC_INLINE macro, see
0021 /// https://libc.llvm.org/dev/code_style.html.
0022 ///
0023 /// For the user-facing documentation see:
0024 /// http://clang.llvm.org/extra/clang-tidy/checks/llvmlibc/inline-function-decl-check.html
0025 class InlineFunctionDeclCheck : public ClangTidyCheck {
0026 public:
0027   InlineFunctionDeclCheck(StringRef Name, ClangTidyContext *Context);
0028 
0029   bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
0030     return LangOpts.CPlusPlus;
0031   }
0032 
0033   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
0034   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
0035 
0036   // Ignore implicit functions (e.g. implicit constructors or destructors)
0037   std::optional<TraversalKind> getCheckTraversalKind() const override {
0038     return TK_IgnoreUnlessSpelledInSource;
0039   }
0040 
0041 private:
0042   FileExtensionsSet HeaderFileExtensions;
0043 };
0044 
0045 } // namespace clang::tidy::llvm_libc
0046 
0047 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVMLIBC_INLINEFUNCTIONDECLCHECK_H