#include "UnsafeFunctionsCheck.h"
#include "../utils/OptionsUtils.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include <cassert>
usingnamespaceclang::ast_matchers;
usingnamespacellvm;
namespace clang::tidy::bugprone {
static constexpr llvm::StringLiteral OptionNameCustomFunctions = …;
static constexpr llvm::StringLiteral OptionNameReportDefaultFunctions = …;
static constexpr llvm::StringLiteral OptionNameReportMoreUnsafeFunctions = …;
static constexpr llvm::StringLiteral FunctionNamesWithAnnexKReplacementId = …;
static constexpr llvm::StringLiteral FunctionNamesId = …;
static constexpr llvm::StringLiteral AdditionalFunctionNamesId = …;
static constexpr llvm::StringLiteral CustomFunctionNamesId = …;
static constexpr llvm::StringLiteral DeclRefId = …;
static std::optional<std::string>
getAnnexKReplacementFor(StringRef FunctionName) { … }
static StringRef getReplacementFor(StringRef FunctionName,
bool IsAnnexKAvailable) { … }
static StringRef getReplacementForAdditional(StringRef FunctionName,
bool IsAnnexKAvailable) { … }
static StringRef getRationaleFor(StringRef FunctionName) { … }
static bool isAnnexKAvailable(std::optional<bool> &CacheVar, Preprocessor *PP,
const LangOptions &LO) { … }
static std::vector<UnsafeFunctionsCheck::CheckedFunction>
parseCheckedFunctions(StringRef Option, ClangTidyContext *Context) { … }
static std::string serializeCheckedFunctions(
const std::vector<UnsafeFunctionsCheck::CheckedFunction> &Functions) { … }
UnsafeFunctionsCheck::UnsafeFunctionsCheck(StringRef Name,
ClangTidyContext *Context)
: … { … }
void UnsafeFunctionsCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { … }
void UnsafeFunctionsCheck::registerMatchers(MatchFinder *Finder) { … }
void UnsafeFunctionsCheck::check(const MatchFinder::MatchResult &Result) { … }
void UnsafeFunctionsCheck::registerPPCallbacks(
const SourceManager &SM, Preprocessor *PP,
Preprocessor * ) { … }
void UnsafeFunctionsCheck::onEndOfTranslationUnit() { … }
}