clang API Documentation
Visitor that tries to report interesting diagnostics from conditions. More...
#include <BugReporterVisitor.h>
Public Member Functions | |
void | Profile (llvm::FoldingSetNodeID &ID) const override |
PathDiagnosticPiece * | VisitNode (const ExplodedNode *N, const ExplodedNode *Prev, BugReporterContext &BRC, BugReport &BR) override |
Return a diagnostic piece which should be associated with the given node. | |
PathDiagnosticPiece * | VisitNodeImpl (const ExplodedNode *N, const ExplodedNode *Prev, BugReporterContext &BRC, BugReport &BR) |
PathDiagnosticPiece * | VisitTerminator (const Stmt *Term, const ExplodedNode *N, const CFGBlock *srcBlk, const CFGBlock *dstBlk, BugReport &R, BugReporterContext &BRC) |
PathDiagnosticPiece * | VisitTrueTest (const Expr *Cond, bool tookTrue, BugReporterContext &BRC, BugReport &R, const ExplodedNode *N) |
PathDiagnosticPiece * | VisitTrueTest (const Expr *Cond, const DeclRefExpr *DR, const bool tookTrue, BugReporterContext &BRC, BugReport &R, const ExplodedNode *N) |
PathDiagnosticPiece * | VisitTrueTest (const Expr *Cond, const BinaryOperator *BExpr, const bool tookTrue, BugReporterContext &BRC, BugReport &R, const ExplodedNode *N) |
PathDiagnosticPiece * | VisitConditionVariable (StringRef LhsString, const Expr *CondVarExpr, const bool tookTrue, BugReporterContext &BRC, BugReport &R, const ExplodedNode *N) |
bool | patternMatch (const Expr *Ex, raw_ostream &Out, BugReporterContext &BRC, BugReport &R, const ExplodedNode *N, Optional< bool > &prunable) |
Static Public Member Functions | |
static const char * | getTag () |
Visitor that tries to report interesting diagnostics from conditions.
Definition at line 184 of file BugReporterVisitor.h.
const char * ConditionBRVisitor::getTag | ( | ) | [static] |
Return the tag associated with this visitor. This tag will be used to make all PathDiagnosticPieces created by this visitor.
Definition at line 1146 of file BugReporterVisitors.cpp.
Referenced by eventsDescribeSameCondition(), and VisitNode().
bool ConditionBRVisitor::patternMatch | ( | const Expr * | Ex, |
raw_ostream & | Out, | ||
BugReporterContext & | BRC, | ||
BugReport & | R, | ||
const ExplodedNode * | N, | ||
Optional< bool > & | prunable | ||
) |
Definition at line 1268 of file BugReporterVisitors.cpp.
References clang::ento::SVal::getAsRegion(), clang::ento::ExplodedNode::getLocationContext(), clang::ento::ProgramState::getLValue(), clang::ento::ExplodedNode::getState(), clang::ento::ProgramState::getSVal(), clang::Expr::getType(), clang::Expr::IgnoreParenCasts(), clang::ento::BugReport::isInteresting(), clang::Type::isObjCObjectPointerType(), and clang::Type::isPointerType().
Referenced by VisitTrueTest().
void clang::ento::ConditionBRVisitor::Profile | ( | llvm::FoldingSetNodeID & | ID | ) | const [inline, override, virtual] |
Implements clang::ento::BugReporterVisitor.
Definition at line 186 of file BugReporterVisitor.h.
PathDiagnosticPiece * ConditionBRVisitor::VisitConditionVariable | ( | StringRef | LhsString, |
const Expr * | CondVarExpr, | ||
const bool | tookTrue, | ||
BugReporterContext & | BRC, | ||
BugReport & | R, | ||
const ExplodedNode * | N | ||
) |
Definition at line 1409 of file BugReporterVisitors.cpp.
References clang::ento::SVal::getAsRegion(), clang::ento::ExplodedNode::getLocationContext(), clang::ento::ProgramState::getLValue(), clang::ento::BugReporterContext::getSourceManager(), clang::ento::ExplodedNode::getState(), clang::Expr::getType(), clang::Type::isBooleanType(), clang::Type::isIntegralOrEnumerationType(), clang::ento::BugReport::isInteresting(), clang::Type::isObjCObjectPointerType(), and clang::Type::isPointerType().
Referenced by VisitTrueTest().
PathDiagnosticPiece * ConditionBRVisitor::VisitNode | ( | const ExplodedNode * | Succ, |
const ExplodedNode * | Pred, | ||
BugReporterContext & | BRC, | ||
BugReport & | BR | ||
) | [override, virtual] |
Return a diagnostic piece which should be associated with the given node.
The last parameter can be used to register a new visitor with the given BugReport while processing a node.
Implements clang::ento::BugReporterVisitor.
Definition at line 1150 of file BugReporterVisitors.cpp.
References getTag(), clang::ento::PathDiagnosticPiece::setTag(), and VisitNodeImpl().
PathDiagnosticPiece * ConditionBRVisitor::VisitNodeImpl | ( | const ExplodedNode * | N, |
const ExplodedNode * | Prev, | ||
BugReporterContext & | BRC, | ||
BugReport & | BR | ||
) |
Definition at line 1163 of file BugReporterVisitors.cpp.
References clang::ProgramPoint::getAs(), clang::ento::BugReporterContext::getBugReporter(), clang::ento::ExplodedNode::getLocation(), clang::ento::ExplodedNode::getState(), clang::CFGBlock::getTerminator(), VisitTerminator(), and VisitTrueTest().
Referenced by VisitNode().
PathDiagnosticPiece * ConditionBRVisitor::VisitTerminator | ( | const Stmt * | Term, |
const ExplodedNode * | N, | ||
const CFGBlock * | srcBlk, | ||
const CFGBlock * | dstBlk, | ||
BugReport & | R, | ||
BugReporterContext & | BRC | ||
) |
Definition at line 1210 of file BugReporterVisitors.cpp.
References clang::Stmt::getStmtClass(), clang::CFGBlock::succ_begin(), clang::CFGBlock::succ_size(), and VisitTrueTest().
Referenced by VisitNodeImpl().
PathDiagnosticPiece * ConditionBRVisitor::VisitTrueTest | ( | const Expr * | Cond, |
bool | tookTrue, | ||
BugReporterContext & | BRC, | ||
BugReport & | R, | ||
const ExplodedNode * | N | ||
) |
Definition at line 1236 of file BugReporterVisitors.cpp.
References clang::UnaryOperator::getOpcode(), clang::Stmt::getStmtClass(), clang::UnaryOperator::getSubExpr(), clang::Expr::IgnoreParenCasts(), and clang::UO_LNot.
Referenced by VisitNodeImpl(), and VisitTerminator().
PathDiagnosticPiece * ConditionBRVisitor::VisitTrueTest | ( | const Expr * | Cond, |
const DeclRefExpr * | DR, | ||
const bool | tookTrue, | ||
BugReporterContext & | BRC, | ||
BugReport & | R, | ||
const ExplodedNode * | N | ||
) |
Definition at line 1454 of file BugReporterVisitors.cpp.
References clang::DeclRefExpr::getDecl(), clang::NamedDecl::getDeclName(), clang::ento::ExplodedNode::getLocationContext(), clang::ento::BugReporterContext::getSourceManager(), clang::ento::ExplodedNode::getState(), clang::ValueDecl::getType(), clang::ento::BugReport::isInteresting(), clang::Type::isObjCObjectPointerType(), clang::Type::isPointerType(), and clang::Type::isScalarType().
PathDiagnosticPiece * ConditionBRVisitor::VisitTrueTest | ( | const Expr * | Cond, |
const BinaryOperator * | BExpr, | ||
const bool | tookTrue, | ||
BugReporterContext & | BRC, | ||
BugReport & | R, | ||
const ExplodedNode * | N | ||
) |
Definition at line 1323 of file BugReporterVisitors.cpp.
References clang::BO_EQ, clang::BO_GE, clang::BO_GT, clang::BO_LE, clang::BO_LT, clang::BO_NE, clang::BinaryOperator::getLHS(), clang::ento::ExplodedNode::getLocationContext(), clang::BinaryOperator::getOpcode(), clang::BinaryOperator::getOpcodeStr(), clang::BinaryOperator::getRHS(), clang::ento::BugReporterContext::getSourceManager(), clang::BinaryOperator::isAssignmentOp(), clang::BinaryOperator::isComparisonOp(), patternMatch(), clang::ento::PathDiagnosticEventPiece::setPrunable(), and VisitConditionVariable().