10#include "clang/AST/ASTContext.h"
11#include "clang/ASTMatchers/ASTMatchFinder.h"
91 "::getwchar_unlocked",
124 "::__ppc_get_timebase_freq",
126 "::putchar_unlocked",
130 "::putwchar_unlocked",
133 "::register_printf_function",
200 "::getchar_unlocked",
213 "::getprotobynumber",
241 "::putchar_unlocked",
264 static llvm::ArrayRef<
265 std::pair<concurrency::MtUnsafeCheck::FunctionSet, StringRef>>
276namespace concurrency {
278static ast_matchers::internal::Matcher<clang::NamedDecl>
288 llvm_unreachable(
"invalid FunctionSet");
307 const auto *Call = Result.Nodes.getNodeAs<CallExpr>(
"mt-unsafe");
308 assert(Call &&
"Unhandled binding in the Matcher");
310 diag(Call->getBeginLoc(),
"function is not thread safe");
llvm::SmallString< 256U > Name
static const clang::StringRef GlibcFunctions[]
static const clang::StringRef PosixFunctions[]
void store(ClangTidyOptions::OptionMap &Options, StringRef LocalName, StringRef Value) const
Stores an option with the check-local name LocalName with string value Value to Options.
Base class for all clang-tidy checks.
DiagnosticBuilder diag(SourceLocation Loc, StringRef Description, DiagnosticIDs::Level Level=DiagnosticIDs::Warning)
Add a diagnostic with the check's name.
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Checks that non-thread-safe functions are not used.
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
MtUnsafeCheck(StringRef Name, ClangTidyContext *Context)
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
static ast_matchers::internal::Matcher< clang::NamedDecl > hasAnyMtUnsafeNames(MtUnsafeCheck::FunctionSet Libc)
llvm::StringMap< ClangTidyValue > OptionMap
static llvm::ArrayRef< std::pair< concurrency::MtUnsafeCheck::FunctionSet, StringRef > > getEnumMapping()
This class should be specialized by any enum type that needs to be converted to and from an llvm::Str...