NodeContext VisitMemberExpr(MemberExpr* ME) { NodeContext result(ME); if (ME->isArrow()) { result.prepend(SynthesizeCheck(ME->getLocStart(), ME->getBase()->IgnoreImplicit())); } return result; }
NodeContext VisitUnaryOperator(UnaryOperator* UnOp) { NodeContext result(UnOp); if (UnOp->getOpcode() == UO_Deref) { result.prepend(SynthesizeCheck(UnOp->getLocStart(), UnOp->getSubExpr())); } return result; }
bool VisitMemberExpr(MemberExpr* ME) { Expr* Base = ME->getBase(); VisitStmt(Base); if (ME->isArrow() && !llvm::isa<clang::CXXThisExpr>(Base) && ME->getMemberDecl()->isCXXInstanceMember()) ME->setBase(SynthesizeCheck(Base)); return true; }
bool VisitUnaryOperator(UnaryOperator* UnOp) { Expr* SubExpr = UnOp->getSubExpr(); VisitStmt(SubExpr); if (UnOp->getOpcode() == UO_Deref && !llvm::isa<clang::CXXThisExpr>(SubExpr) && SubExpr->getType().getTypePtr()->isPointerType()) UnOp->setSubExpr(SynthesizeCheck(SubExpr)); return true; }
void VisitCallExpr(CallExpr* CE) { Visit(CE->getCallee()); FunctionDecl* FDecl = CE->getDirectCallee(); if (FDecl && isDeclCandidate(FDecl)) { decl_map_t::const_iterator it = m_NonNullArgIndexs.find(FDecl); const std::bitset<32>& ArgIndexs = it->second; Sema::ContextRAII pushedDC(m_Sema, FDecl); for (int index = 0; index < 32; ++index) { if (ArgIndexs.test(index)) { // Get the argument with the nonnull attribute. Expr* Arg = CE->getArg(index); CE->setArg(index, SynthesizeCheck(Arg)); } } } }
bool VisitCallExpr(CallExpr* CE) { VisitStmt(CE->getCallee()); FunctionDecl* FDecl = CE->getDirectCallee(); if (FDecl && isDeclCandidate(FDecl)) { decl_map_t::const_iterator it = m_NonNullArgIndexs.find(FDecl); const std::bitset<32>& ArgIndexs = it->second; Sema::ContextRAII pushedDC(m_Sema, FDecl); for (int index = 0; index < 32; ++index) { if (ArgIndexs.test(index)) { // Get the argument with the nonnull attribute. Expr* Arg = CE->getArg(index); if (Arg->getType().getTypePtr()->isPointerType() && !llvm::isa<clang::CXXThisExpr>(Arg)) CE->setArg(index, SynthesizeCheck(Arg)); } } } return true; }
void VisitMemberExpr(MemberExpr* ME) { Visit(ME->getBase()); if (ME->isArrow()) { ME->setBase(SynthesizeCheck(ME->getBase())); } }
void VisitUnaryOperator(UnaryOperator* UnOp) { Visit(UnOp->getSubExpr()); if (UnOp->getOpcode() == UO_Deref) { UnOp->setSubExpr(SynthesizeCheck(UnOp->getSubExpr())); } }