25class TrustReturnsNonnullChecker :
public Checker<check::PostCall> {
28 TrustReturnsNonnullChecker(ASTContext &Ctx) {}
30 void checkPostCall(
const CallEvent &
Call, CheckerContext &
C)
const {
33 if (isNonNullPtr(
Call))
34 if (
auto L =
Call.getReturnValue().getAs<Loc>())
35 State = State->assume(*L,
true);
37 C.addTransition(State);
42 bool isNonNullPtr(
const CallEvent &
Call)
const {
43 QualType ExprRetType =
Call.getResultType();
44 const Decl *CallDeclaration =
Call.getDecl();
48 return CallDeclaration->
hasAttr<ReturnsNonNullAttr>();
54void ento::registerTrustReturnsNonnullChecker(
CheckerManager &Mgr) {
58bool ento::shouldRegisterTrustReturnsNonnullChecker(
const CheckerManager &mgr) {
bool isAnyPointerType() const
ASTContext & getASTContext() const
CHECKER * registerChecker(AT &&...Args)
Register a single-part checker (derived from Checker): construct its singleton instance,...
Simple checker classes that implement one frontend (i.e.
IntrusiveRefCntPtr< const ProgramState > ProgramStateRef
std::variant< struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl, struct ModuleDecl, struct ExcludeDecl, struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl, struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl, struct ConflictDecl > Decl
All declarations that can appear in a module declaration.
The JSON file list parser is used to communicate input to InstallAPI.