clang  8.0.0svn
Public Member Functions | Static Public Member Functions | List of all members
clang::ento::PathDiagnosticLocation Class Reference

#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 StmtasStmt () const
 
const StmtgetStmtOrNull () const
 
const DeclasDecl () const
 
bool hasRange () const
 
void invalidate ()
 
void flatten ()
 
const SourceManagergetManager () 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 StmtgetStmt (const ExplodedNode *N)
 Given an exploded node, retrieve the statement that should be used for the diagnostic location. More...
 
static const StmtgetNextStmt (const ExplodedNode *N)
 Retrieve the statement corresponding to the successor node. More...
 

Detailed Description

Definition at line 156 of file PathDiagnostic.h.

Constructor & Destructor Documentation

◆ PathDiagnosticLocation() [1/4]

clang::ento::PathDiagnosticLocation::PathDiagnosticLocation ( )
default

Create an invalid location.

◆ PathDiagnosticLocation() [2/4]

clang::ento::PathDiagnosticLocation::PathDiagnosticLocation ( const Stmt s,
const SourceManager sm,
LocationOrAnalysisDeclContext  lac 
)
inline

Create a location corresponding to the given statement.

Definition at line 181 of file PathDiagnostic.h.

References clang::SourceLocation::isValid(), and clang::SourceRange::isValid().

◆ PathDiagnosticLocation() [3/4]

clang::ento::PathDiagnosticLocation::PathDiagnosticLocation ( const Decl d,
const SourceManager sm 
)
inline

Create a location corresponding to the given declaration.

Definition at line 192 of file PathDiagnostic.h.

References clang::SourceLocation::isValid(), and clang::SourceRange::isValid().

◆ PathDiagnosticLocation() [4/4]

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 202 of file PathDiagnostic.h.

References clang::SourceLocation::isValid(), and clang::SourceRange::isValid().

Member Function Documentation

◆ asDecl()

const Decl* clang::ento::PathDiagnosticLocation::asDecl ( ) const
inline

Definition at line 313 of file PathDiagnostic.h.

◆ asLocation()

FullSourceLoc clang::ento::PathDiagnosticLocation::asLocation ( ) const
inline

◆ asRange()

PathDiagnosticRange clang::ento::PathDiagnosticLocation::asRange ( ) const
inline

◆ asStmt()

const Stmt* clang::ento::PathDiagnosticLocation::asStmt ( ) const
inline

Definition at line 306 of file PathDiagnostic.h.

◆ create() [1/2]

static PathDiagnosticLocation clang::ento::PathDiagnosticLocation::create ( const Decl D,
const SourceManager SM 
)
inlinestatic

◆ create() [2/2]

PathDiagnosticLocation PathDiagnosticLocation::create ( const ProgramPoint P,
const SourceManager SMng 
)
static

◆ createBegin() [1/3]

PathDiagnosticLocation PathDiagnosticLocation::createBegin ( const Decl D,
const SourceManager SM 
)
static

◆ createBegin() [2/3]

static PathDiagnosticLocation clang::ento::PathDiagnosticLocation::createBegin ( const Decl D,
const SourceManager SM,
const LocationOrAnalysisDeclContext  LAC 
)
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 222 of file PathDiagnostic.h.

References clang::serialized_diags::create(), and P.

◆ createBegin() [3/3]

static PathDiagnosticLocation clang::ento::PathDiagnosticLocation::createBegin ( const Stmt S,
const SourceManager SM,
const LocationOrAnalysisDeclContext  LAC 
)
static

Create a location for the beginning of the statement.

◆ createBeginBrace()

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 679 of file PathDiagnostic.cpp.

References clang::CompoundStmt::getLBracLoc().

◆ createConditionalColonLoc()

PathDiagnosticLocation PathDiagnosticLocation::createConditionalColonLoc ( const ConditionalOperator CO,
const SourceManager SM 
)
static

Definition at line 666 of file PathDiagnostic.cpp.

References clang::AbstractConditionalOperator::getColonLoc(), and SM.

◆ createDeclBegin()

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 693 of file PathDiagnostic.cpp.

References clang::Decl::getBody(), and clang::LocationContext::getDecl().

◆ createDeclEnd()

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 706 of file PathDiagnostic.cpp.

References clang::Decl::getBodyRBrace(), and clang::LocationContext::getDecl().

◆ createEnd()

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 650 of file PathDiagnostic.cpp.

References getValidSourceLocation().

Referenced by create(), createEndOfPath(), and getLocationForCaller().

◆ createEndBrace()

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 686 of file PathDiagnostic.cpp.

References clang::CompoundStmt::getRBracLoc().

Referenced by generatePathDiagnosticsForNode().

◆ createEndOfPath()

PathDiagnosticLocation PathDiagnosticLocation::createEndOfPath ( const ExplodedNode N,
const SourceManager SM 
)
static

◆ createMemberLoc()

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 673 of file PathDiagnostic.cpp.

References clang::MemberExpr::getMemberLoc(), and SM.

Referenced by createEndOfPath().

◆ createOperatorLoc()

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 660 of file PathDiagnostic.cpp.

References clang::BinaryOperator::getOperatorLoc(), and SM.

Referenced by createEndOfPath(), and generateDiagForBinaryOP().

◆ createSingleLocation()

PathDiagnosticLocation PathDiagnosticLocation::createSingleLocation ( const PathDiagnosticLocation PDL)
static

Convert the given location into a single kind location.

Definition at line 862 of file PathDiagnostic.cpp.

References asLocation(), clang::FullSourceLoc::getManager(), clang::Stmt::getStmtClass(), and getValidSourceLocation().

Referenced by CompactPathDiagnostic().

◆ dump()

LLVM_DUMP_METHOD void PathDiagnosticLocation::dump ( ) const

◆ flatten()

void PathDiagnosticLocation::flatten ( )

◆ getManager()

const SourceManager& clang::ento::PathDiagnosticLocation::getManager ( ) const
inline

◆ getNextStmt()

const Stmt * PathDiagnosticLocation::getNextStmt ( const ExplodedNode N)
static

Retrieve the statement corresponding to the successor node.

Definition at line 795 of file PathDiagnostic.cpp.

References clang::ento::ExplodedNode::getFirstSucc(), and clang::Stmt::getStmtClass().

Referenced by generateMinimalDiagForBlockEdge().

◆ getStmt()

const Stmt * PathDiagnosticLocation::getStmt ( const ExplodedNode N)
static

◆ getStmtOrNull()

const Stmt* clang::ento::PathDiagnosticLocation::getStmtOrNull ( ) const
inline

Definition at line 307 of file PathDiagnostic.h.

◆ hasRange()

bool clang::ento::PathDiagnosticLocation::hasRange ( ) const
inline

◆ invalidate()

void clang::ento::PathDiagnosticLocation::invalidate ( )
inline

Definition at line 317 of file PathDiagnostic.h.

◆ isValid()

bool clang::ento::PathDiagnosticLocation::isValid ( ) const
inline

◆ operator!=()

bool clang::ento::PathDiagnosticLocation::operator!= ( const PathDiagnosticLocation X) const
inline

Definition at line 290 of file PathDiagnostic.h.

References X.

◆ operator==()

bool clang::ento::PathDiagnosticLocation::operator== ( const PathDiagnosticLocation X) const
inline

Definition at line 286 of file PathDiagnostic.h.

◆ Profile()

void PathDiagnosticLocation::Profile ( llvm::FoldingSetNodeID &  ID) const

The documentation for this class was generated from the following files: