|
clang
5.0.0
|
Visitor that tries to report interesting diagnostics from conditions. More...
#include "clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h"
Public Member Functions | |
| void | Profile (llvm::FoldingSetNodeID &ID) const override |
| std::shared_ptr < 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. More... | |
| std::shared_ptr < PathDiagnosticPiece > | VisitNodeImpl (const ExplodedNode *N, const ExplodedNode *Prev, BugReporterContext &BRC, BugReport &BR) |
| std::shared_ptr < PathDiagnosticPiece > | VisitTerminator (const Stmt *Term, const ExplodedNode *N, const CFGBlock *srcBlk, const CFGBlock *dstBlk, BugReport &R, BugReporterContext &BRC) |
| std::shared_ptr < PathDiagnosticPiece > | VisitTrueTest (const Expr *Cond, bool tookTrue, BugReporterContext &BRC, BugReport &R, const ExplodedNode *N) |
| std::shared_ptr < PathDiagnosticPiece > | VisitTrueTest (const Expr *Cond, const DeclRefExpr *DR, const bool tookTrue, BugReporterContext &BRC, BugReport &R, const ExplodedNode *N) |
| std::shared_ptr < PathDiagnosticPiece > | VisitTrueTest (const Expr *Cond, const BinaryOperator *BExpr, const bool tookTrue, BugReporterContext &BRC, BugReport &R, const ExplodedNode *N) |
| std::shared_ptr < PathDiagnosticPiece > | VisitConditionVariable (StringRef LhsString, const Expr *CondVarExpr, const bool tookTrue, BugReporterContext &BRC, BugReport &R, const ExplodedNode *N) |
| bool | patternMatch (const Expr *Ex, const Expr *ParentEx, raw_ostream &Out, BugReporterContext &BRC, BugReport &R, const ExplodedNode *N, Optional< bool > &prunable) |
Public Member Functions inherited from clang::ento::BugReporterVisitor | |
| BugReporterVisitor ()=default | |
| BugReporterVisitor (const BugReporterVisitor &)=default | |
| BugReporterVisitor (BugReporterVisitor &&) | |
| virtual | ~BugReporterVisitor () |
| virtual std::unique_ptr < PathDiagnosticPiece > | getEndPath (BugReporterContext &BRC, const ExplodedNode *N, BugReport &BR) |
| Provide custom definition for the final diagnostic piece on the path - the piece, which is displayed before the path is expanded. More... | |
Static Public Member Functions | |
| static const char * | getTag () |
| Return the tag associated with this visitor. More... | |
| static bool | isPieceMessageGeneric (const PathDiagnosticPiece *Piece) |
Static Public Member Functions inherited from clang::ento::BugReporterVisitor | |
| static std::unique_ptr < PathDiagnosticPiece > | getDefaultEndPath (BugReporterContext &BRC, const ExplodedNode *N, BugReport &BR) |
| Generates the default final diagnostic piece. More... | |
Visitor that tries to report interesting diagnostics from conditions.
Definition at line 185 of file BugReporterVisitor.h.
|
static |
Return the tag associated with this visitor.
This tag will be used to make all PathDiagnosticPieces created by this visitor.
Definition at line 1219 of file BugReporterVisitors.cpp.
Referenced by eventsDescribeSameCondition(), and VisitNode().
|
static |
Definition at line 1650 of file BugReporterVisitors.cpp.
References clang::ento::PathDiagnosticPiece::getString().
Referenced by eventsDescribeSameCondition().
| bool ConditionBRVisitor::patternMatch | ( | const Expr * | Ex, |
| const Expr * | ParentEx, | ||
| raw_ostream & | Out, | ||
| BugReporterContext & | BRC, | ||
| BugReport & | R, | ||
| const ExplodedNode * | N, | ||
| Optional< bool > & | prunable | ||
| ) |
Definition at line 1384 of file BugReporterVisitors.cpp.
References clang::ento::SVal::getAsRegion(), clang::ento::BugReporterContext::getASTContext(), clang::SourceManager::getImmediateMacroCallerLoc(), clang::Lexer::getImmediateMacroNameForDiagnostics(), clang::ASTContext::getLangOpts(), clang::ento::ExplodedNode::getLocationContext(), clang::Stmt::getLocEnd(), clang::Stmt::getLocStart(), clang::ento::ProgramState::getLValue(), clang::ento::BugReporterContext::getSourceManager(), clang::ento::ExplodedNode::getState(), clang::ento::ProgramState::getSVal(), clang::Expr::getType(), clang::Expr::IgnoreParenCasts(), clang::ento::BugReport::isInteresting(), clang::SourceLocation::isMacroID(), clang::Type::isObjCObjectPointerType(), clang::Type::isPointerType(), and clang::CodeGen::state.
Referenced by VisitTrueTest().
|
inlineoverridevirtual |
Implements clang::ento::BugReporterVisitor.
Definition at line 193 of file BugReporterVisitor.h.
| std::shared_ptr< PathDiagnosticPiece > ConditionBRVisitor::VisitConditionVariable | ( | StringRef | LhsString, |
| const Expr * | CondVarExpr, | ||
| const bool | tookTrue, | ||
| BugReporterContext & | BRC, | ||
| BugReport & | R, | ||
| const ExplodedNode * | N | ||
| ) |
Definition at line 1563 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(), clang::Type::isPointerType(), and clang::CodeGen::state.
Referenced by VisitTrueTest().
|
overridevirtual |
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 1224 of file BugReporterVisitors.cpp.
References getTag(), and VisitNodeImpl().
| std::shared_ptr< PathDiagnosticPiece > ConditionBRVisitor::VisitNodeImpl | ( | const ExplodedNode * | N, |
| const ExplodedNode * | Prev, | ||
| BugReporterContext & | BRC, | ||
| BugReport & | BR | ||
| ) |
Definition at line 1236 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().
| std::shared_ptr< PathDiagnosticPiece > ConditionBRVisitor::VisitTerminator | ( | const Stmt * | Term, |
| const ExplodedNode * | N, | ||
| const CFGBlock * | srcBlk, | ||
| const CFGBlock * | dstBlk, | ||
| BugReport & | R, | ||
| BugReporterContext & | BRC | ||
| ) |
Definition at line 1281 of file BugReporterVisitors.cpp.
References clang::Stmt::getStmtClass(), clang::Expr::IgnoreParens(), clang::CFGBlock::succ_begin(), clang::CFGBlock::succ_size(), and VisitTrueTest().
Referenced by VisitNodeImpl().
| std::shared_ptr< PathDiagnosticPiece > ConditionBRVisitor::VisitTrueTest | ( | const Expr * | Cond, |
| bool | tookTrue, | ||
| BugReporterContext & | BRC, | ||
| BugReport & | R, | ||
| const ExplodedNode * | N | ||
| ) |
Definition at line 1337 of file BugReporterVisitors.cpp.
References clang::ento::ExplodedNode::getLocationContext(), clang::UnaryOperator::getOpcode(), clang::ento::BugReporterContext::getSourceManager(), clang::Stmt::getStmtClass(), clang::UnaryOperator::getSubExpr(), clang::Expr::IgnoreParenCasts(), and P.
Referenced by VisitNodeImpl(), and VisitTerminator().
| std::shared_ptr< PathDiagnosticPiece > ConditionBRVisitor::VisitTrueTest | ( | const Expr * | Cond, |
| const DeclRefExpr * | DR, | ||
| const bool | tookTrue, | ||
| BugReporterContext & | BRC, | ||
| BugReport & | R, | ||
| const ExplodedNode * | N | ||
| ) |
Definition at line 1604 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(), clang::Type::isScalarType(), and clang::CodeGen::state.
| std::shared_ptr< PathDiagnosticPiece > ConditionBRVisitor::VisitTrueTest | ( | const Expr * | Cond, |
| const BinaryOperator * | BExpr, | ||
| const bool | tookTrue, | ||
| BugReporterContext & | BRC, | ||
| BugReport & | R, | ||
| const ExplodedNode * | N | ||
| ) |
Definition at line 1482 of file BugReporterVisitors.cpp.
References 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(), and VisitConditionVariable().
1.8.6