llvm-project/clang-tools-extra/clang-tidy/android/CloexecMemfdCreateCheck.cpp
Carlos Galvez 7d2ea6c422 [clang-tidy][NFC] Use C++17 nested namespaces in the clang-tidy folder
Fix applied by running:

run-clang-tidy.py -checks=-*,modernize-concat-nested-namespaces

Differential Revision: https://reviews.llvm.org/D141770
2023-01-14 18:51:39 +00:00

28 lines
1.0 KiB
C++

//===--- CloexecMemfdCreateCheck.cpp - clang-tidy--------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "CloexecMemfdCreateCheck.h"
using namespace clang::ast_matchers;
namespace clang::tidy::android {
void CloexecMemfdCreateCheck::registerMatchers(MatchFinder *Finder) {
auto CharPointerType = hasType(pointerType(pointee(isAnyCharacter())));
registerMatchersImpl(
Finder, functionDecl(returns(isInteger()), hasName("memfd_create"),
hasParameter(0, CharPointerType),
hasParameter(1, hasType(isInteger()))));
}
void CloexecMemfdCreateCheck::check(const MatchFinder::MatchResult &Result) {
insertMacroFlag(Result, "MFD_CLOEXEC", /*ArgPos=*/1);
}
} // namespace clang::tidy::android