clang API Documentation
#include <PathDiagnostic.h>
Public Member Functions | |
PathDiagnosticLocation () | |
Create an invalid location. | |
PathDiagnosticLocation (const Stmt *s, const SourceManager &sm, LocationOrAnalysisDeclContext lac) | |
Create a location corresponding to the given statement. | |
PathDiagnosticLocation (const Decl *d, const SourceManager &sm) | |
Create a location corresponding to the given declaration. | |
PathDiagnosticLocation (SourceLocation loc, const SourceManager &sm) | |
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 Decl * | asDecl () const |
bool | hasRange () 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. | |
static PathDiagnosticLocation | createBegin (const Decl *D, const SourceManager &SM) |
Create a location for the beginning of the declaration. | |
static PathDiagnosticLocation | createBegin (const Stmt *S, const SourceManager &SM, const LocationOrAnalysisDeclContext LAC) |
Create a location for the beginning of the statement. | |
static PathDiagnosticLocation | createEnd (const Stmt *S, const SourceManager &SM, const LocationOrAnalysisDeclContext LAC) |
static PathDiagnosticLocation | createOperatorLoc (const BinaryOperator *BO, const SourceManager &SM) |
static PathDiagnosticLocation | createConditionalColonLoc (const ConditionalOperator *CO, const SourceManager &SM) |
static PathDiagnosticLocation | createMemberLoc (const MemberExpr *ME, const SourceManager &SM) |
static PathDiagnosticLocation | createBeginBrace (const CompoundStmt *CS, const SourceManager &SM) |
static PathDiagnosticLocation | createEndBrace (const CompoundStmt *CS, const SourceManager &SM) |
static PathDiagnosticLocation | createDeclBegin (const LocationContext *LC, const SourceManager &SM) |
static PathDiagnosticLocation | createDeclEnd (const LocationContext *LC, const SourceManager &SM) |
static PathDiagnosticLocation | create (const ProgramPoint &P, const SourceManager &SMng) |
Create a location corresponding to the given valid ExplodedNode. | |
static PathDiagnosticLocation | createEndOfPath (const ExplodedNode *N, const SourceManager &SM) |
static PathDiagnosticLocation | createSingleLocation (const PathDiagnosticLocation &PDL) |
Convert the given location into a single kind location. | |
static const Stmt * | getStmt (const ExplodedNode *N) |
Given an exploded node, retrieve the statement that should be used for the diagnostic location. | |
static const Stmt * | getNextStmt (const ExplodedNode *N) |
Retrieve the statement corresponding to the successor node. |
Definition at line 130 of file PathDiagnostic.h.
clang::ento::PathDiagnosticLocation::PathDiagnosticLocation | ( | ) | [inline] |
Create an invalid location.
Definition at line 154 of file PathDiagnostic.h.
Referenced by create(), and invalidate().
clang::ento::PathDiagnosticLocation::PathDiagnosticLocation | ( | const Stmt * | s, |
const SourceManager & | sm, | ||
LocationOrAnalysisDeclContext | lac | ||
) | [inline] |
Create a location corresponding to the given statement.
Definition at line 158 of file PathDiagnostic.h.
References clang::SourceRange::isValid().
clang::ento::PathDiagnosticLocation::PathDiagnosticLocation | ( | const Decl * | d, |
const SourceManager & | sm | ||
) | [inline] |
Create a location corresponding to the given declaration.
Definition at line 172 of file PathDiagnostic.h.
References clang::SourceRange::isValid().
clang::ento::PathDiagnosticLocation::PathDiagnosticLocation | ( | SourceLocation | loc, |
const SourceManager & | sm | ||
) | [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 183 of file PathDiagnostic.h.
References clang::SourceRange::isValid().
const Decl* clang::ento::PathDiagnosticLocation::asDecl | ( | ) | const [inline] |
Definition at line 280 of file PathDiagnostic.h.
References isValid().
FullSourceLoc clang::ento::PathDiagnosticLocation::asLocation | ( | ) | const [inline] |
Definition at line 271 of file PathDiagnostic.h.
Referenced by addEdgeToPath(), adjustCallLocations(), CompactPathDiagnostic(), compare(), compareCall(), compareControlFlow(), comparePiece(), createSingleLocation(), GenerateMinimalPathDiagnostic(), clang::ento::LikelyFalsePositiveSuppressionBRVisitor::getEndPath(), getFirstStackedCallToHeaderFile(), clang::ento::PathDiagnosticConsumer::HandlePathDiagnostic(), optimizeEdges(), clang::ento::PathDiagnosticSpotPiece::PathDiagnosticSpotPiece(), ReportEvent(), and clang::ento::FindLastStoreBRVisitor::VisitNode().
PathDiagnosticRange clang::ento::PathDiagnosticLocation::asRange | ( | ) | const [inline] |
Definition at line 275 of file PathDiagnostic.h.
Referenced by clang::ento::PathDiagnosticSpotPiece::PathDiagnosticSpotPiece().
const Stmt* clang::ento::PathDiagnosticLocation::asStmt | ( | ) | const [inline] |
Definition at line 279 of file PathDiagnostic.h.
References isValid().
Referenced by addContextEdges(), addEdgeToPath(), GenerateExtensivePathDiagnostic(), GenerateMinimalPathDiagnostic(), and getLocStmt().
static PathDiagnosticLocation clang::ento::PathDiagnosticLocation::create | ( | const Decl * | D, |
const SourceManager & | SM | ||
) | [inline, static] |
Create a location corresponding to the given declaration.
Definition at line 191 of file PathDiagnostic.h.
References PathDiagnosticLocation().
Referenced by checkObjCUnusedIvar(), and clang::ento::FindLastStoreBRVisitor::VisitNode().
PathDiagnosticLocation PathDiagnosticLocation::create | ( | const ProgramPoint & | P, |
const SourceManager & | SMng | ||
) | [static] |
Create a location corresponding to the given valid ExplodedNode.
Definition at line 661 of file PathDiagnostic.cpp.
References createEnd(), clang::ProgramPoint::getAs(), clang::ProgramPoint::getLocationContext(), getLocationForCaller(), clang::CFGBlock::getTerminatorCondition(), and S.
PathDiagnosticLocation PathDiagnosticLocation::createBegin | ( | const Decl * | D, |
const SourceManager & | SM | ||
) | [static] |
Create a location for the beginning of the declaration.
Definition at line 581 of file PathDiagnostic.cpp.
References clang::Decl::getLocStart(), and SM.
Referenced by checkObjCDealloc(), CompareReturnTypes(), dropFunctionEntryEdge(), GenerateAlternateExtensivePathDiagnostic(), GenerateExtensivePathDiagnostic(), GenerateMinimalPathDiagnostic(), and clang::ento::PathDiagnosticCallPiece::setCallee().
PathDiagnosticLocation PathDiagnosticLocation::createBegin | ( | const Stmt * | S, |
const SourceManager & | SM, | ||
const LocationOrAnalysisDeclContext | LAC | ||
) | [static] |
Create a location for the beginning of the statement.
Definition at line 587 of file PathDiagnostic.cpp.
References getValidSourceLocation().
PathDiagnosticLocation PathDiagnosticLocation::createBeginBrace | ( | const CompoundStmt * | CS, |
const SourceManager & | SM | ||
) | [static] |
Create a location for the beginning of the compound statement. Assumes the statement has a valid location.
Definition at line 626 of file PathDiagnostic.cpp.
References clang::CompoundStmt::getLBracLoc().
PathDiagnosticLocation PathDiagnosticLocation::createConditionalColonLoc | ( | const ConditionalOperator * | CO, |
const SourceManager & | SM | ||
) | [static] |
Definition at line 612 of file PathDiagnostic.cpp.
References clang::AbstractConditionalOperator::getColonLoc(), and SM.
PathDiagnosticLocation PathDiagnosticLocation::createDeclBegin | ( | const LocationContext * | LC, |
const SourceManager & | 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 640 of file PathDiagnostic.cpp.
References clang::Decl::getBody(), and clang::LocationContext::getDecl().
PathDiagnosticLocation PathDiagnosticLocation::createDeclEnd | ( | const LocationContext * | LC, |
const SourceManager & | SM | ||
) | [static] |
Constructs a location for the end of the enclosing declaration body. Defaults to the end of brace.
Definition at line 654 of file PathDiagnostic.cpp.
References clang::Decl::getBodyRBrace(), and clang::LocationContext::getDecl().
PathDiagnosticLocation PathDiagnosticLocation::createEnd | ( | const Stmt * | S, |
const SourceManager & | SM, | ||
const LocationOrAnalysisDeclContext | LAC | ||
) | [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 596 of file PathDiagnostic.cpp.
References getValidSourceLocation().
Referenced by create(), createEndOfPath(), and getLocationForCaller().
PathDiagnosticLocation PathDiagnosticLocation::createEndBrace | ( | const CompoundStmt * | CS, |
const SourceManager & | SM | ||
) | [static] |
Create a location for the end of the compound statement. Assumes the statement has a valid location.
Definition at line 633 of file PathDiagnostic.cpp.
References clang::CompoundStmt::getRBracLoc().
Referenced by GenerateAlternateExtensivePathDiagnostic(), and GenerateExtensivePathDiagnostic().
PathDiagnosticLocation PathDiagnosticLocation::createEndOfPath | ( | const ExplodedNode * | N, |
const SourceManager & | SM | ||
) | [static] |
Create a location corresponding to the next valid ExplodedNode as end of path location.
Definition at line 736 of file PathDiagnostic.cpp.
References createEnd(), createMemberLoc(), createOperatorLoc(), clang::ProgramPoint::getAs(), clang::ento::ExplodedNode::getLocation(), clang::ento::ExplodedNode::getLocationAs(), clang::ento::ExplodedNode::getLocationContext(), clang::Stmt::getLocStart(), getValidSourceLocation(), clang::SourceLocation::isValid(), P, S, and SM.
Referenced by clang::ento::BugReporterVisitor::getDefaultEndPath(), and clang::ento::BugReport::getLocation().
PathDiagnosticLocation PathDiagnosticLocation::createMemberLoc | ( | const MemberExpr * | ME, |
const SourceManager & | SM | ||
) | [static] |
For member expressions, return the location of the '.' or '->'. Assumes the statement has a valid location.
Definition at line 620 of file PathDiagnostic.cpp.
References clang::MemberExpr::getMemberLoc(), and SM.
Referenced by createEndOfPath().
PathDiagnosticLocation PathDiagnosticLocation::createOperatorLoc | ( | const BinaryOperator * | BO, |
const SourceManager & | SM | ||
) | [static] |
Create the location for the operator of the binary expression. Assumes the statement has a valid location.
Definition at line 606 of file PathDiagnostic.cpp.
References clang::BinaryOperator::getOperatorLoc(), and SM.
Referenced by createEndOfPath(), and GenerateMinimalPathDiagnostic().
PathDiagnosticLocation PathDiagnosticLocation::createSingleLocation | ( | const PathDiagnosticLocation & | PDL | ) | [static] |
Convert the given location into a single kind location.
Definition at line 771 of file PathDiagnostic.cpp.
References asLocation(), and clang::FullSourceLoc::getManager().
Referenced by CompactPathDiagnostic().
void PathDiagnosticLocation::dump | ( | ) | const |
Definition at line 3532 of file BugReporter.cpp.
References clang::Stmt::dump(), and clang::ento::BugReport::isValid().
Referenced by clang::ento::PathDiagnosticEventPiece::dump(), and clang::ento::PathDiagnosticCallPiece::dump().
void PathDiagnosticLocation::flatten | ( | ) |
Definition at line 864 of file PathDiagnostic.cpp.
Referenced by clang::ento::PathDiagnosticLocationPair::flatten(), clang::ento::PathDiagnosticSpotPiece::flattenLocations(), and clang::ento::PathDiagnosticCallPiece::flattenLocations().
const SourceManager& clang::ento::PathDiagnosticLocation::getManager | ( | ) | const [inline] |
Definition at line 290 of file PathDiagnostic.h.
References isValid().
Referenced by clang::ento::PathDiagnostic::resetDiagnosticLocationToMainFile().
const Stmt * PathDiagnosticLocation::getNextStmt | ( | const ExplodedNode * | N | ) | [static] |
Retrieve the statement corresponding to the successor node.
Definition at line 708 of file PathDiagnostic.cpp.
References clang::BO_LAnd, clang::BO_LOr, clang::ento::ExplodedNode::getFirstSucc(), and S.
Referenced by GenerateMinimalPathDiagnostic().
const Stmt * PathDiagnosticLocation::getStmt | ( | const ExplodedNode * | N | ) | [static] |
Given an exploded node, retrieve the statement that should be used for the diagnostic location.
Definition at line 692 of file PathDiagnostic.cpp.
References clang::ProgramPoint::getAs(), clang::ento::ExplodedNode::getLocation(), and P.
Referenced by GetCurrentOrPreviousStmt(), and GetPreviousStmt().
bool clang::ento::PathDiagnosticLocation::hasRange | ( | ) | const [inline] |
Definition at line 282 of file PathDiagnostic.h.
Referenced by clang::ento::PathDiagnosticSpotPiece::PathDiagnosticSpotPiece().
void clang::ento::PathDiagnosticLocation::invalidate | ( | ) | [inline] |
Definition at line 284 of file PathDiagnostic.h.
References PathDiagnosticLocation().
Referenced by GenerateAlternateExtensivePathDiagnostic().
bool clang::ento::PathDiagnosticLocation::isValid | ( | ) | const [inline] |
Definition at line 267 of file PathDiagnostic.h.
Referenced by addContextEdges(), addEdgeToPath(), asDecl(), asStmt(), clang::ento::BugReporter::emitReport(), clang::ento::BugReport::getLocation(), getLocStmt(), getManager(), clang::ento::PathDiagnosticSpotPiece::PathDiagnosticSpotPiece(), clang::ento::BugReport::Profile(), clang::ento::FindLastStoreBRVisitor::VisitNode(), and clang::ento::TrackConstraintBRVisitor::VisitNode().
bool clang::ento::PathDiagnosticLocation::operator!= | ( | const PathDiagnosticLocation & | X | ) | const [inline] |
Definition at line 263 of file PathDiagnostic.h.
References X.
bool clang::ento::PathDiagnosticLocation::operator== | ( | const PathDiagnosticLocation & | X | ) | const [inline] |
Definition at line 259 of file PathDiagnostic.h.
void PathDiagnosticLocation::Profile | ( | llvm::FoldingSetNodeID & | ID | ) | const |
Definition at line 1059 of file PathDiagnostic.cpp.
Referenced by clang::ento::BugReport::Profile(), and clang::ento::PathDiagnosticLocationPair::Profile().