#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
usingnamespaceclang;
usingnamespaceento;
static bool IsNSError(QualType T, IdentifierInfo *II);
static bool IsCFError(QualType T, IdentifierInfo *II);
namespace {
class NSErrorMethodChecker
: public Checker< check::ASTDecl<ObjCMethodDecl> > { … };
}
void NSErrorMethodChecker::checkASTDecl(const ObjCMethodDecl *D,
AnalysisManager &mgr,
BugReporter &BR) const { … }
namespace {
class CFErrorFunctionChecker
: public Checker< check::ASTDecl<FunctionDecl> > { … };
}
static bool hasReservedReturnType(const FunctionDecl *D) { … }
void CFErrorFunctionChecker::checkASTDecl(const FunctionDecl *D,
AnalysisManager &mgr,
BugReporter &BR) const { … }
namespace {
class NSErrorDerefBug : public BugType { … };
class CFErrorDerefBug : public BugType { … };
}
namespace {
class NSOrCFErrorDerefChecker
: public Checker< check::Location,
check::Event<ImplicitNullDerefEvent> > { … };
}
ErrorOutFlag;
REGISTER_TRAIT_WITH_PROGRAMSTATE(…)
REGISTER_TRAIT_WITH_PROGRAMSTATE(…)
template <typename T>
static bool hasFlag(SVal val, ProgramStateRef state) { … }
template <typename T>
static void setFlag(ProgramStateRef state, SVal val, CheckerContext &C) { … }
static QualType parameterTypeFromSVal(SVal val, CheckerContext &C) { … }
void NSOrCFErrorDerefChecker::checkLocation(SVal loc, bool isLoad,
const Stmt *S,
CheckerContext &C) const { … }
void NSOrCFErrorDerefChecker::checkEvent(ImplicitNullDerefEvent event) const { … }
static bool IsNSError(QualType T, IdentifierInfo *II) { … }
static bool IsCFError(QualType T, IdentifierInfo *II) { … }
void ento::registerNSOrCFErrorDerefChecker(CheckerManager &mgr) { … }
bool ento::shouldRegisterNSOrCFErrorDerefChecker(const CheckerManager &mgr) { … }
void ento::registerNSErrorChecker(CheckerManager &mgr) { … }
bool ento::shouldRegisterNSErrorChecker(const CheckerManager &mgr) { … }
void ento::registerCFErrorChecker(CheckerManager &mgr) { … }
bool ento::shouldRegisterCFErrorChecker(const CheckerManager &mgr) { … }