clang 20.0.0git
|
#include "clang/Analysis/PathDiagnostic.h"
Public Member Functions | |
PathDiagnosticLocation ()=default | |
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) | |
Create a location at an explicit offset in the source. | |
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. | |
static PathDiagnosticLocation | createBegin (const Decl *D, const SourceManager &SM) |
Create a location for the beginning of the declaration. | |
static PathDiagnosticLocation | createBegin (const Decl *D, const SourceManager &SM, const LocationOrAnalysisDeclContext LAC) |
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) |
Create a location for the end of the statement. | |
static PathDiagnosticLocation | createOperatorLoc (const BinaryOperator *BO, const SourceManager &SM) |
Create the location for the operator of the binary expression. | |
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 '. | |
static PathDiagnosticLocation | createBeginBrace (const CompoundStmt *CS, const SourceManager &SM) |
Create a location for the beginning of the compound statement. | |
static PathDiagnosticLocation | createEndBrace (const CompoundStmt *CS, const SourceManager &SM) |
Create a location for the end of the compound statement. | |
static PathDiagnosticLocation | createDeclBegin (const LocationContext *LC, const SourceManager &SM) |
Create a location for the beginning of the enclosing declaration body. | |
static PathDiagnosticLocation | createDeclEnd (const LocationContext *LC, const SourceManager &SM) |
Constructs a location for the end of the enclosing declaration body. | |
static PathDiagnosticLocation | create (const ProgramPoint &P, const SourceManager &SMng) |
Create a location corresponding to the given valid ProgramPoint. | |
static PathDiagnosticLocation | createSingleLocation (const PathDiagnosticLocation &PDL) |
Convert the given location into a single kind location. | |
static SourceLocation | getValidSourceLocation (const Stmt *S, LocationOrAnalysisDeclContext LAC, bool UseEndOfStatement=false) |
Construct a source location that corresponds to either the beginning or the end of the given statement, or a nearby valid source location if the statement does not have a valid source location of its own. | |
Definition at line 195 of file PathDiagnostic.h.
|
default |
Create an invalid location.
Referenced by create(), and invalidate().
|
inline |
Create a location corresponding to the given statement.
Definition at line 220 of file PathDiagnostic.h.
References clang::ento::DefinedSVal::isValid(), and SM.
|
inline |
Create a location corresponding to the given declaration.
Definition at line 231 of file PathDiagnostic.h.
References D, clang::ento::DefinedSVal::isValid(), and 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 241 of file PathDiagnostic.h.
References clang::ento::DefinedSVal::isValid(), and SM.
|
inline |
Definition at line 354 of file PathDiagnostic.h.
|
inline |
Definition at line 339 of file PathDiagnostic.h.
Referenced by addEdgeToPath(), compare(), compareCall(), compareControlFlow(), comparePiece(), clang::ento::bugreporter::StoreHandler::constructNote(), createSingleLocation(), clang::ento::LikelyFalsePositiveSuppressionBRVisitor::finalizeVisitor(), getFirstStackedCallToHeaderFile(), getIssueHash(), clang::ento::PathDiagnosticConsumer::HandlePathDiagnostic(), and hasValidLocation().
|
inline |
Definition at line 343 of file PathDiagnostic.h.
Referenced by clang::ento::BugSuppression::isSuppressed(), and clang::ento::PathDiagnosticSpotPiece::PathDiagnosticSpotPiece().
|
inline |
Definition at line 347 of file PathDiagnostic.h.
References isValid().
Referenced by addContextEdges(), addEdgeToPath(), and getStmtOrNull().
|
inlinestatic |
Create a location corresponding to the given declaration.
Definition at line 248 of file PathDiagnostic.h.
References D, PathDiagnosticLocation(), and SM.
Referenced by annotateConsumedSummaryMismatch(), checkObjCUnusedIvar(), clang::ento::bugreporter::StoreHandler::constructNote(), getLocationForCaller(), clang::ento::TrackConstraintBRVisitor::VisitNode(), clang::ento::retaincountchecker::RefCountReportVisitor::VisitNode(), and clang::ento::TagVisitor::VisitNode().
|
static |
Create a location corresponding to the given valid ProgramPoint.
Definition at line 665 of file PathDiagnostic.cpp.
References createBegin(), createEnd(), clang::CFG::getEntry(), getLocationForCaller(), clang::CFGBlock::getParent(), clang::CFGBlock::getTerminator(), clang::CFGBlock::getTerminatorCondition(), clang::CFGTerminator::isVirtualBaseBranch(), and P.
|
static |
Create a location for the beginning of the declaration.
Definition at line 579 of file PathDiagnostic.cpp.
References D, clang::Decl::getBeginLoc(), and SM.
Referenced by CompareReturnTypes(), constructDebugPieceForTrackedCondition(), create(), createBegin(), dropFunctionEntryEdge(), emitDiagnostics(), clang::ento::PathSensitiveBugReport::getLocation(), makeLocation(), and clang::ento::PathDiagnosticCallPiece::setCallee().
|
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 261 of file PathDiagnostic.h.
References createBegin(), D, and SM.
|
static |
Create a location for the beginning of the statement.
Definition at line 585 of file PathDiagnostic.cpp.
References SM.
|
static |
Create a location for the beginning of the compound statement.
Assumes the statement has a valid location.
Definition at line 631 of file PathDiagnostic.cpp.
References clang::CompoundStmt::getLBracLoc(), and SM.
|
static |
Definition at line 610 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 645 of file PathDiagnostic.cpp.
References clang::Decl::getBody(), clang::LocationContext::getDecl(), and SM.
|
static |
Constructs a location for the end of the enclosing declaration body.
Defaults to the end of brace.
Definition at line 658 of file PathDiagnostic.cpp.
References clang::Decl::getBodyRBrace(), clang::LocationContext::getDecl(), and SM.
Referenced by clang::ento::PathSensitiveBugReport::getLocation().
|
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 594 of file PathDiagnostic.cpp.
References SM.
Referenced by create(), clang::ento::PathSensitiveBugReport::getLocation(), and getLocationForCaller().
|
static |
Create a location for the end of the compound statement.
Assumes the statement has a valid location.
Definition at line 638 of file PathDiagnostic.cpp.
References clang::CompoundStmt::getRBracLoc(), and SM.
|
static |
For member expressions, return the location of the '.
' or '->'. Assumes the statement has a valid location.
Definition at line 617 of file PathDiagnostic.cpp.
References clang::MemberExpr::getBeginLoc(), clang::MemberExpr::getMemberLoc(), clang::SourceLocation::isValid(), and SM.
Referenced by clang::ento::PathSensitiveBugReport::getLocation().
|
static |
Create the location for the operator of the binary expression.
Assumes the statement has a valid location.
Definition at line 604 of file PathDiagnostic.cpp.
References clang::BinaryOperator::getOperatorLoc(), and SM.
Referenced by clang::ento::PathSensitiveBugReport::getLocation().
|
static |
Convert the given location into a single kind location.
Definition at line 738 of file PathDiagnostic.cpp.
References asLocation(), and clang::FullSourceLoc::getManager().
Referenced by CompactMacroExpandedPieces().
LLVM_DUMP_METHOD void PathDiagnosticLocation::dump | ( | ) | const |
Definition at line 1205 of file PathDiagnostic.cpp.
References D.
void PathDiagnosticLocation::flatten | ( | ) |
Definition at line 831 of file PathDiagnostic.cpp.
References D.
Referenced by clang::ento::PathDiagnosticLocationPair::flatten(), clang::ento::PathDiagnosticSpotPiece::flattenLocations(), and clang::ento::PathDiagnosticCallPiece::flattenLocations().
|
inline |
Definition at line 366 of file PathDiagnostic.h.
Referenced by clang::ento::BugSuppression::isSuppressed(), and resetDiagnosticLocationToMainFile().
|
inline |
Definition at line 348 of file PathDiagnostic.h.
References asStmt(), and isValid().
Referenced by addContextEdges(), and simplifySimpleBranches().
|
static |
Construct a source location that corresponds to either the beginning or the end of the given statement, or a nearby valid source location if the statement does not have a valid source location of its own.
Definition at line 476 of file PathDiagnostic.cpp.
References clang::Stmt::getBeginLoc(), clang::AnalysisDeclContext::getBody(), clang::AnalysisDeclContext::getDecl(), clang::Decl::getEndLoc(), clang::AnalysisDeclContext::getParentMap(), clang::SourceLocation::isValid(), and Parent.
Referenced by clang::ento::PathSensitiveBugReport::getLocation().
|
inline |
Definition at line 356 of file PathDiagnostic.h.
Referenced by clang::ento::PathDiagnosticSpotPiece::PathDiagnosticSpotPiece().
|
inline |
Definition at line 358 of file PathDiagnostic.h.
References asLocation(), and clang::SourceLocation::isValid().
Referenced by clang::ento::PathDiagnosticSpotPiece::PathDiagnosticSpotPiece().
|
inline |
Definition at line 360 of file PathDiagnostic.h.
References PathDiagnosticLocation().
|
inline |
Definition at line 335 of file PathDiagnostic.h.
References SM.
Referenced by addContextEdges(), addEdgeToPath(), asDecl(), asStmt(), clang::ento::bugreporter::StoreHandler::constructNote(), getIssueHash(), clang::ento::BasicBugReport::getLocation(), clang::ento::retaincountchecker::RefLeakReport::getLocation(), getManager(), getStmtOrNull(), clang::ento::BugSuppression::isSuppressed(), clang::ento::PathDiagnosticSpotPiece::PathDiagnosticSpotPiece(), clang::ento::BasicBugReport::Profile(), clang::ento::PathSensitiveBugReport::Profile(), and clang::ento::TrackConstraintBRVisitor::VisitNode().
|
inline |
Definition at line 331 of file PathDiagnostic.h.
References X.
|
inline |
Definition at line 327 of file PathDiagnostic.h.
References X.
void PathDiagnosticLocation::Profile | ( | llvm::FoldingSetNodeID & | ID | ) | const |
Definition at line 1087 of file PathDiagnostic.cpp.
Referenced by clang::ento::BasicBugReport::Profile(), clang::ento::PathSensitiveBugReport::Profile(), and clang::ento::PathDiagnosticLocationPair::Profile().