//===-- CalleeNamespaceCheck.cpp ------------------------------------------===// // // 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 "CalleeNamespaceCheck.h" #include "NamespaceConstants.h" #include "clang/AST/ASTContext.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/ASTMatchers/ASTMatchers.h" #include "llvm/ADT/StringSet.h" usingnamespaceclang::ast_matchers; namespace clang::tidy::llvm_libc { // Gets the outermost namespace of a DeclContext, right under the Translation // Unit. const DeclContext *getOutermostNamespace(const DeclContext *Decl) { … } void CalleeNamespaceCheck::registerMatchers(MatchFinder *Finder) { … } // A list of functions that are exempted from this check. The __errno_location // function is for setting errno, which is allowed in libc, and the other // functions are specifically allowed to be external so that they can be // intercepted. static const llvm::StringSet<> IgnoredFunctions = …; void CalleeNamespaceCheck::check(const MatchFinder::MatchResult &Result) { … } } // namespace clang::tidy::llvm_libc