clang-tools
22.0.0git
llvm-project
clang-tools-extra
clang-tidy
android
CloexecEpollCreateCheck.cpp
Go to the documentation of this file.
1
//===----------------------------------------------------------------------===//
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
#include "
CloexecEpollCreateCheck.h
"
10
#include "clang/ASTMatchers/ASTMatchFinder.h"
11
12
using namespace
clang::ast_matchers
;
13
14
namespace
clang::tidy::android
{
15
16
void
CloexecEpollCreateCheck::registerMatchers
(MatchFinder *Finder) {
17
registerMatchersImpl
(
18
Finder, functionDecl(returns(isInteger()), hasName(
"epoll_create"
),
19
hasParameter(0, hasType(isInteger()))));
20
}
21
22
void
CloexecEpollCreateCheck::check
(
const
MatchFinder::MatchResult &Result) {
23
replaceFunc
(Result,
24
"prefer epoll_create() to epoll_create1() "
25
"because epoll_create1() allows "
26
"EPOLL_CLOEXEC"
,
27
"epoll_create1(EPOLL_CLOEXEC)"
);
28
}
29
30
}
// namespace clang::tidy::android
CloexecEpollCreateCheck.h
clang::tidy::android::CloexecCheck::replaceFunc
void replaceFunc(const ast_matchers::MatchFinder::MatchResult &Result, StringRef WarningMsg, StringRef FixMsg)
Type2 is to replace the API to another function that has required the ability.
Definition
CloexecCheck.cpp:72
clang::tidy::android::CloexecCheck::registerMatchersImpl
void registerMatchersImpl(ast_matchers::MatchFinder *Finder, ast_matchers::internal::Matcher< FunctionDecl > Function)
Definition
CloexecCheck.cpp:41
clang::tidy::android::CloexecEpollCreateCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
Definition
CloexecEpollCreateCheck.cpp:22
clang::tidy::android::CloexecEpollCreateCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Definition
CloexecEpollCreateCheck.cpp:16
clang::ast_matchers
Definition
AbseilMatcher.h:13
clang::tidy::android
Definition
AndroidTidyModule.cpp:31
Generated on
for clang-tools by
1.14.0