clang-tools
20.0.0git
llvm-project
clang-tools-extra
clang-tidy
llvmlibc
InlineFunctionDeclCheck.h
Go to the documentation of this file.
1
//===-- InlineFunctionDeclCheck.h -------------------------------*- 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_LLVMLIBC_INLINEFUNCTIONDECLCHECK_H
10
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVMLIBC_INLINEFUNCTIONDECLCHECK_H
11
12
#include "../ClangTidyCheck.h"
13
#include "../FileExtensionsSet.h"
14
15
namespace
clang::tidy::llvm_libc
{
16
17
/// Checks that explicitly and implicitly inline functions in headers files
18
/// are tagged with the LIBC_INLINE macro.
19
///
20
/// For more information about the LIBC_INLINE macro, see
21
/// https://libc.llvm.org/dev/code_style.html.
22
///
23
/// For the user-facing documentation see:
24
/// http://clang.llvm.org/extra/clang-tidy/checks/llvmlibc/inline-function-decl-check.html
25
class
InlineFunctionDeclCheck
:
public
ClangTidyCheck
{
26
public
:
27
InlineFunctionDeclCheck
(StringRef
Name
,
ClangTidyContext
*Context);
28
29
bool
isLanguageVersionSupported
(
const
LangOptions &LangOpts)
const override
{
30
return
LangOpts.CPlusPlus;
31
}
32
33
void
registerMatchers
(ast_matchers::MatchFinder *Finder)
override
;
34
void
check
(
const
ast_matchers::MatchFinder::MatchResult &Result)
override
;
35
36
// Ignore implicit functions (e.g. implicit constructors or destructors)
37
std::optional<TraversalKind>
getCheckTraversalKind
()
const override
{
38
return
TK_IgnoreUnlessSpelledInSource;
39
}
40
41
private
:
42
FileExtensionsSet
HeaderFileExtensions;
43
};
44
45
}
// namespace clang::tidy::llvm_libc
46
47
#endif
// LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVMLIBC_INLINEFUNCTIONDECLCHECK_H
Name
llvm::SmallString< 256U > Name
Definition:
ChainedComparisonCheck.cpp:42
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition:
ClangTidyCheck.h:53
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition:
ClangTidyDiagnosticConsumer.h:69
clang::tidy::llvm_libc::InlineFunctionDeclCheck
Checks that explicitly and implicitly inline functions in headers files are tagged with the LIBC_INLI...
Definition:
InlineFunctionDeclCheck.h:25
clang::tidy::llvm_libc::InlineFunctionDeclCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Definition:
InlineFunctionDeclCheck.cpp:47
clang::tidy::llvm_libc::InlineFunctionDeclCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition:
InlineFunctionDeclCheck.cpp:53
clang::tidy::llvm_libc::InlineFunctionDeclCheck::isLanguageVersionSupported
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
Override this to disable registering matchers and PP callbacks if an invalid language version is bein...
Definition:
InlineFunctionDeclCheck.h:29
clang::tidy::llvm_libc::InlineFunctionDeclCheck::getCheckTraversalKind
std::optional< TraversalKind > getCheckTraversalKind() const override
Definition:
InlineFunctionDeclCheck.h:37
clang::tidy::llvm_libc
Definition:
CalleeNamespaceCheck.cpp:19
clang::tidy::FileExtensionsSet
llvm::SmallSet< llvm::StringRef, 5 > FileExtensionsSet
Definition:
FileExtensionsSet.h:16
Generated on Wed Nov 20 2024 18:24:44 for clang-tools by
1.9.6