clang-tools
6.0.0
llvm.src
tools
clang
tools
extra
clang-tidy
android
CloexecInotifyInitCheck.cpp
Go to the documentation of this file.
1
//===--- CloexecInotifyInitCheck.cpp - clang-tidy--------------------------===//
2
//
3
// The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
10
#include "
CloexecInotifyInitCheck.h
"
11
#include "clang/AST/ASTContext.h"
12
#include "clang/ASTMatchers/ASTMatchFinder.h"
13
14
using namespace
clang::ast_matchers
;
15
16
namespace
clang
{
17
namespace
tidy {
18
namespace
android {
19
20
void
CloexecInotifyInitCheck::registerMatchers(MatchFinder *Finder) {
21
registerMatchersImpl(
22
Finder, functionDecl(returns(isInteger()), hasName(
"inotify_init"
)));
23
}
24
25
void
CloexecInotifyInitCheck::check(
const
MatchFinder::MatchResult &Result) {
26
replaceFunc(Result,
/*WarningMsg=*/
27
"prefer inotify_init() to inotify_init1() "
28
"because inotify_init1() allows IN_CLOEXEC"
,
29
/*FixMsg=*/
"inotify_init1(IN_CLOEXEC)"
);
30
}
31
32
}
// namespace android
33
}
// namespace tidy
34
}
// namespace clang
clang::ast_matchers
Definition:
ClangTidyDiagnosticConsumer.h:27
CloexecInotifyInitCheck.h
clang
Definition:
AndroidTidyModule.cpp:28
Generated on Fri Mar 2 2018 13:29:34 for clang-tools by
1.8.13