Chih-Hung Hsieh | 3be4ecb | 2017-08-16 17:53:12 +0000 | [diff] [blame] | 1 | //===--- CloexecEpollCreate1Check.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 "CloexecEpollCreate1Check.h" |
| 11 | #include "../utils/ASTUtils.h" |
| 12 | #include "clang/AST/ASTContext.h" |
| 13 | #include "clang/ASTMatchers/ASTMatchFinder.h" |
| 14 | |
| 15 | using namespace clang::ast_matchers; |
| 16 | |
| 17 | namespace clang { |
| 18 | namespace tidy { |
| 19 | namespace android { |
| 20 | |
| 21 | void CloexecEpollCreate1Check::registerMatchers(MatchFinder *Finder) { |
| 22 | registerMatchersImpl( |
| 23 | Finder, functionDecl(returns(isInteger()), hasName("epoll_create1"), |
| 24 | hasParameter(0, hasType(isInteger())))); |
| 25 | } |
| 26 | |
| 27 | void CloexecEpollCreate1Check::check(const MatchFinder::MatchResult &Result) { |
Benjamin Kramer | 26f2eec | 2018-02-02 13:39:07 +0000 | [diff] [blame] | 28 | insertMacroFlag(Result, /*MacroFlag=*/"EPOLL_CLOEXEC", /*ArgPos=*/0); |
Chih-Hung Hsieh | 3be4ecb | 2017-08-16 17:53:12 +0000 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | } // namespace android |
| 32 | } // namespace tidy |
| 33 | } // namespace clang |