clang
9.0.0
|
#include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"
Public Member Functions | |
PathDiagnosticLocation ()=default | |
Create an invalid location. More... | |
PathDiagnosticLocation (const Stmt *s, const SourceManager &sm, LocationOrAnalysisDeclContext lac) | |
Create a location corresponding to the given statement. More... | |
PathDiagnosticLocation (const Decl *d, const SourceManager &sm) | |
Create a location corresponding to the given declaration. More... | |
PathDiagnosticLocation (SourceLocation loc, const SourceManager &sm) | |
Create a location at an explicit offset in the source. More... | |
bool | operator== (const PathDiagnosticLocation &X) const |
bool | operator!= (const PathDiagnosticLocation &X) const |
bool | isValid () const |
FullSourceLoc | asLocation () const |
PathDiagnosticRange | asRange () const |
const Stmt * | asStmt () const |
const Stmt * | getStmtOrNull () const |
const Decl * | asDecl () const |
bool | hasRange () const |
bool | hasValidLocation () const |
void | invalidate () |
void | flatten () |
const SourceManager & | getManager () const |
void | Profile (llvm::FoldingSetNodeID &ID) const |
void | dump () const |
Static Public Member Functions | |
static PathDiagnosticLocation | create (const Decl *D, const SourceManager &SM) |
Create a location corresponding to the given declaration. More... | |
static PathDiagnosticLocation | createBegin (const Decl *D, const SourceManager &SM) |
Create a location for the beginning of the declaration. More... | |
static PathDiagnosticLocation | createBegin (const Decl *D, const SourceManager &SM, const LocationOrAnalysisDeclContext LAC) |
Create a location for the beginning of the declaration. More... | |
static PathDiagnosticLocation | createBegin (const Stmt *S, const SourceManager &SM, const LocationOrAnalysisDeclContext LAC) |
Create a location for the beginning of the statement. More... | |
static PathDiagnosticLocation | createEnd (const Stmt *S, const SourceManager &SM, const LocationOrAnalysisDeclContext LAC) |
Create a location for the end of the statement. More... | |
static PathDiagnosticLocation | createOperatorLoc (const BinaryOperator *BO, const SourceManager &SM) |
Create the location for the operator of the binary expression. More... | |
static PathDiagnosticLocation | createConditionalColonLoc (const ConditionalOperator *CO, const SourceManager &SM) |
static PathDiagnosticLocation | createMemberLoc (const MemberExpr *ME, const SourceManager &SM) |
For member expressions, return the location of the '. More... | |
static PathDiagnosticLocation | createBeginBrace (const CompoundStmt *CS, const SourceManager &SM) |
Create a location for the beginning of the compound statement. More... | |
static PathDiagnosticLocation | createEndBrace (const CompoundStmt *CS, const SourceManager &SM) |
Create a location for the end of the compound statement. More... | |
static PathDiagnosticLocation | createDeclBegin (const LocationContext *LC, const SourceManager &SM) |
Create a location for the beginning of the enclosing declaration body. More... | |
static PathDiagnosticLocation | createDeclEnd (const LocationContext *LC, const SourceManager &SM) |
Constructs a location for the end of the enclosing declaration body. More... | |
static PathDiagnosticLocation | create (const ProgramPoint &P, const SourceManager &SMng) |
Create a location corresponding to the given valid ExplodedNode. More... | |
static PathDiagnosticLocation | createEndOfPath (const ExplodedNode *N, const SourceManager &SM) |
Create a location corresponding to the next valid ExplodedNode as end of path location. More... | |
static PathDiagnosticLocation | createSingleLocation (const PathDiagnosticLocation &PDL) |
Convert the given location into a single kind location. More... | |
static const Stmt * | getStmt (const ExplodedNode *N) |
Given an exploded node, retrieve the statement that should be used for the diagnostic location. More... | |
static const Stmt * | getNextStmt (const ExplodedNode *N) |
Retrieve the statement corresponding to the successor node. More... | |
Definition at line 155 of file PathDiagnostic.h.
|
default |
Create an invalid location.
|
inline |
Create a location corresponding to the given statement.
Definition at line 180 of file PathDiagnostic.h.
References clang::SourceLocation::isValid(), and clang::SourceRange::isValid().
|
inline |
Create a location corresponding to the given declaration.
Definition at line 191 of file PathDiagnostic.h.
References clang::SourceLocation::isValid(), and clang::SourceRange::isValid().
|
inline |
Create a location at an explicit offset in the source.
This should only be used if there are no more appropriate constructors.
Definition at line 201 of file PathDiagnostic.h.
References clang::SourceLocation::isValid(), and clang::SourceRange::isValid().
|
inline |
Definition at line 312 of file PathDiagnostic.h.
|
inline |
Definition at line 297 of file PathDiagnostic.h.
Referenced by createSingleLocation(), clang::ento::PathDiagnosticConsumer::HandlePathDiagnostic(), and clang::ento::taint::TaintBugVisitor::VisitNode().
|
inline |
Definition at line 301 of file PathDiagnostic.h.
Referenced by clang::ento::PathDiagnosticSpotPiece::PathDiagnosticSpotPiece().
|
inline |
Definition at line 305 of file PathDiagnostic.h.
|
inlinestatic |
Create a location corresponding to the given declaration.
Definition at line 208 of file PathDiagnostic.h.
Referenced by checkObjCUnusedIvar(), getLocationForCaller(), isPointerToConst(), LookThroughTransitiveAssignmentsAndCommaOperators(), and clang::ento::mpi::MPIBugReporter::reportUnmatchedWait().
|
static |
Create a location corresponding to the given valid ExplodedNode.
Definition at line 726 of file PathDiagnostic.cpp.
References createBegin(), createEnd(), clang::CFGElement::getAs(), clang::ProgramPoint::getAs(), clang::LocationContext::getDecl(), clang::CFG::getEntry(), clang::ProgramPoint::getLocationContext(), getLocationForCaller(), clang::CFGBlock::getParent(), clang::CFGBlock::getTerminator(), clang::CFGBlock::getTerminatorCondition(), and clang::CFGTerminator::isVirtualBaseBranch().
|
static |
Create a location for the beginning of the declaration.
Definition at line 641 of file PathDiagnostic.cpp.
References clang::Decl::getBeginLoc(), and SM.
Referenced by CheckASTMemory(), CompareReturnTypes(), constructDebugPieceForTrackedCondition(), create(), createEndOfPath(), dropFunctionEntryEdge(), emitDiagnostics(), generateMinimalDiagForBlockEdge(), generatePathDiagnosticForConsumer(), generatePathDiagnosticsForNode(), getAsPointeeSymbol(), getIncrementedVar(), LookThroughTransitiveAssignmentsAndCommaOperators(), clang::ento::PathDiagnosticCallPiece::setCallee(), and clang::ento::taint::TaintBugVisitor::VisitNode().
|
inlinestatic |
Create a location for the beginning of the declaration.
The third argument is ignored, useful for generic treatment of statements and declarations.
Definition at line 221 of file PathDiagnostic.h.
References clang::serialized_diags::create(), and P.
|
static |
Create a location for the beginning of the statement.
|
static |
Create a location for the beginning of the compound statement.
Assumes the statement has a valid location.
Definition at line 692 of file PathDiagnostic.cpp.
References clang::CompoundStmt::getLBracLoc().
|
static |
Definition at line 671 of file PathDiagnostic.cpp.
References clang::AbstractConditionalOperator::getColonLoc(), and SM.
|
static |
Create a location for the beginning of the enclosing declaration body.
Defaults to the beginning of the first statement in the declaration body.
Definition at line 706 of file PathDiagnostic.cpp.
References clang::Decl::getBody(), and clang::LocationContext::getDecl().
|
static |
Constructs a location for the end of the enclosing declaration body.
Defaults to the end of brace.
Definition at line 719 of file PathDiagnostic.cpp.
References clang::Decl::getBodyRBrace(), and clang::LocationContext::getDecl().
|
static |
Create a location for the end of the statement.
If the statement is a CompoundStatement, the location will point to the closing brace instead of following it.
Definition at line 655 of file PathDiagnostic.cpp.
References getValidSourceLocation().
Referenced by create(), createEndOfPath(), and getLocationForCaller().
|
static |
Create a location for the end of the compound statement.
Assumes the statement has a valid location.
Definition at line 699 of file PathDiagnostic.cpp.
References clang::CompoundStmt::getRBracLoc().
Referenced by generatePathDiagnosticsForNode().
|
static |
Create a location corresponding to the next valid ExplodedNode as end of path location.
Definition at line 864 of file PathDiagnostic.cpp.
References createBegin(), createEnd(), createMemberLoc(), createOperatorLoc(), clang::ProgramPoint::getAs(), clang::Stmt::getBeginLoc(), clang::ento::ExplodedNode::getLocation(), clang::ento::ExplodedNode::getLocationAs(), clang::ento::ExplodedNode::getLocationContext(), getValidSourceLocation(), clang::SourceLocation::isValid(), P, and SM.
Referenced by clang::ento::BugReport::getLocation(), and wasRegionOfInterestModifiedAt().
|
static |
For member expressions, return the location of the '.
' or '->'. Assumes the statement has a valid location.
Definition at line 678 of file PathDiagnostic.cpp.
References clang::MemberExpr::getBeginLoc(), clang::MemberExpr::getMemberLoc(), clang::SourceLocation::isValid(), and SM.
Referenced by createEndOfPath().
|
static |
Create the location for the operator of the binary expression.
Assumes the statement has a valid location.
Definition at line 665 of file PathDiagnostic.cpp.
References clang::BinaryOperator::getOperatorLoc(), and SM.
Referenced by createEndOfPath(), and generateDiagForBinaryOP().
|
static |
Convert the given location into a single kind location.
Definition at line 903 of file PathDiagnostic.cpp.
References asLocation(), clang::FullSourceLoc::getManager(), clang::Stmt::getStmtClass(), and getValidSourceLocation().
Referenced by CompactMacroExpandedPieces().
LLVM_DUMP_METHOD void PathDiagnosticLocation::dump | ( | ) | const |
Definition at line 1433 of file PathDiagnostic.cpp.
References clang::Stmt::dump().
Referenced by clang::ento::PathDiagnosticEventPiece::dump(), clang::ento::PathDiagnosticCallPiece::dump(), clang::ento::PathDiagnosticNotePiece::dump(), and clang::ento::PathDiagnosticPopUpPiece::dump().
void PathDiagnosticLocation::flatten | ( | ) |
|
inline |
Definition at line 324 of file PathDiagnostic.h.
References dump(), clang::ento::PathDiagnosticConsumer::PDFileEntry::Profile(), and SM.
Referenced by clang::ento::PathDiagnostic::resetDiagnosticLocationToMainFile().
|
static |
Retrieve the statement corresponding to the successor node.
Definition at line 836 of file PathDiagnostic.cpp.
References clang::ento::ExplodedNode::getFirstSucc(), and clang::Stmt::getStmtClass().
Referenced by generateMinimalDiagForBlockEdge().
|
static |
Given an exploded node, retrieve the statement that should be used for the diagnostic location.
Definition at line 806 of file PathDiagnostic.cpp.
References findTopAutosynthesizedParentContext(), clang::LocationContext::getAnalysisDeclContext(), clang::ProgramPoint::getAs(), clang::ento::ExplodedNode::getLocation(), clang::ento::ExplodedNode::getLocationContext(), clang::AnalysisDeclContext::isBodyAutosynthesized(), and P.
Referenced by CompactMacroExpandedPieces(), getAsPointeeSymbol(), clang::ento::BugReport::getStmt(), isReferenceCountingPointerDestructor(), and clang::ento::taint::TaintBugVisitor::VisitNode().
|
inline |
Definition at line 306 of file PathDiagnostic.h.
|
inline |
Definition at line 314 of file PathDiagnostic.h.
Referenced by clang::ento::PathDiagnosticSpotPiece::PathDiagnosticSpotPiece().
|
inline |
Definition at line 316 of file PathDiagnostic.h.
Referenced by clang::ento::PathDiagnosticSpotPiece::PathDiagnosticSpotPiece().
|
inline |
Definition at line 318 of file PathDiagnostic.h.
|
inline |
Definition at line 293 of file PathDiagnostic.h.
Referenced by clang::ento::PathDiagnosticSpotPiece::PathDiagnosticSpotPiece(), clang::ento::BugReport::Profile(), clang::ento::PathDiagnostic::setEndOfPath(), and clang::ento::taint::TaintBugVisitor::VisitNode().
|
inline |
Definition at line 289 of file PathDiagnostic.h.
References X.
|
inline |
Definition at line 285 of file PathDiagnostic.h.
void PathDiagnosticLocation::Profile | ( | llvm::FoldingSetNodeID & | ID | ) | const |
Definition at line 1252 of file PathDiagnostic.cpp.
Referenced by clang::ento::PathDiagnosticLocationPair::Profile(), and clang::ento::BugReport::Profile().