clang 22.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 isValid(), clang::nullptr, and s.
|
inline |
Create a location corresponding to the given declaration.
Definition at line 231 of file PathDiagnostic.h.
|
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.
|
inline |
Definition at line 354 of file PathDiagnostic.h.
References isValid().
|
inline |
Definition at line 339 of file PathDiagnostic.h.
Referenced by addEdgeToPath(), compare(), compareCall(), compareControlFlow(), comparePiece(), clang::ento::bugreporter::StoreHandler::constructNote(), createSingleLocation(), dump(), clang::ento::LikelyFalsePositiveSuppressionBRVisitor::finalizeVisitor(), getFirstStackedCallToHeaderFile(), getIssueHash(), clang::ento::PathDiagnosticConsumer::HandlePathDiagnostic(), and hasValidLocation().
|
inline |
Definition at line 343 of file PathDiagnostic.h.
|
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 PathDiagnosticLocation().
Referenced by annotateConsumedSummaryMismatch(), checkObjCUnusedIvar(), clang::ento::bugreporter::StoreHandler::constructNote(), getLocationForCaller(), clang::ento::retaincountchecker::RefCountReportVisitor::VisitNode(), clang::ento::TagVisitor::VisitNode(), and clang::ento::TrackConstraintBRVisitor::VisitNode().
|
static |
Create a location corresponding to the given valid ProgramPoint.
Definition at line 660 of file PathDiagnostic.cpp.
References createBegin(), createEnd(), 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 574 of file PathDiagnostic.cpp.
Referenced by CompareReturnTypes(), constructDebugPieceForTrackedCondition(), create(), createBegin(), dropFunctionEntryEdge(), emitDiagnostics(), emitDiagnostics(), 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().
|
static |
Create a location for the beginning of the statement.
Definition at line 580 of file PathDiagnostic.cpp.
References getValidSourceLocation().
|
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().
|
static |
Definition at line 605 of file PathDiagnostic.cpp.
References clang::AbstractConditionalOperator::getColonLoc().
|
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().
|
static |
Constructs a location for the end of the enclosing declaration body.
Defaults to the end of brace.
Definition at line 653 of file PathDiagnostic.cpp.
References clang::Decl::getBodyRBrace(), and clang::LocationContext::getDecl().
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 589 of file PathDiagnostic.cpp.
References createEndBrace(), and getValidSourceLocation().
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 633 of file PathDiagnostic.cpp.
References clang::CompoundStmt::getRBracLoc().
Referenced by createEnd().
|
static |
For member expressions, return the location of the '.
' or '->'. Assumes the statement has a valid location.
Definition at line 612 of file PathDiagnostic.cpp.
References clang::MemberExpr::getBeginLoc(), clang::MemberExpr::getMemberLoc(), and clang::SourceLocation::isValid().
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 599 of file PathDiagnostic.cpp.
References clang::BinaryOperator::getOperatorLoc().
Referenced by clang::ento::PathSensitiveBugReport::getLocation().
|
static |
Convert the given location into a single kind location.
Definition at line 733 of file PathDiagnostic.cpp.
References asLocation(), and clang::FullSourceLoc::getManager().
Referenced by CompactMacroExpandedPieces().
LLVM_DUMP_METHOD void PathDiagnosticLocation::dump | ( | ) | const |
Definition at line 1200 of file PathDiagnostic.cpp.
References asLocation(), clang::isa(), and isValid().
void PathDiagnosticLocation::flatten | ( | ) |
Definition at line 826 of file PathDiagnostic.cpp.
|
inline |
Definition at line 366 of file PathDiagnostic.h.
References isValid().
Referenced by 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 471 of file PathDiagnostic.cpp.
References clang::cast(), clang::Stmt::getBeginLoc(), clang::AnalysisDeclContext::getBody(), clang::AnalysisDeclContext::getDecl(), clang::Decl::getEndLoc(), clang::Stmt::getEndLoc(), clang::ParentMap::getParent(), clang::AnalysisDeclContext::getParentMap(), and clang::SourceLocation::isValid().
Referenced by createBegin(), createEnd(), and clang::ento::PathSensitiveBugReport::getLocation().
|
inline |
Definition at line 356 of file PathDiagnostic.h.
|
inline |
Definition at line 358 of file PathDiagnostic.h.
References asLocation(), and clang::SourceLocation::isValid().
|
inline |
Definition at line 360 of file PathDiagnostic.h.
References PathDiagnosticLocation().
|
inline |
Definition at line 335 of file PathDiagnostic.h.
Referenced by addContextEdges(), addEdgeToPath(), asDecl(), asStmt(), clang::ento::bugreporter::StoreHandler::constructNote(), dump(), getIssueHash(), getManager(), getStmtOrNull(), PathDiagnosticLocation(), 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 1082 of file PathDiagnostic.cpp.
Referenced by clang::ento::PathSensitiveBugReport::Profile().