clang  8.0.0svn
Public Types | Public Member Functions | Public Attributes | List of all members
clang::ento::PathDiagnostic Class Reference

PathDiagnostic - PathDiagnostic objects represent a single path-sensitive diagnostic. More...

#include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"

Inheritance diagram for clang::ento::PathDiagnostic:
Inheritance graph
[legend]
Collaboration diagram for clang::ento::PathDiagnostic:
Collaboration graph
[legend]

Public Types

using meta_iterator = std::deque< std::string >::const_iterator
 
using filesmap_iterator = FilesToLineNumsMap::const_iterator
 

Public Member Functions

 PathDiagnostic ()=delete
 
 PathDiagnostic (StringRef CheckName, const Decl *DeclWithIssue, StringRef bugtype, StringRef verboseDesc, StringRef shortDesc, StringRef category, PathDiagnosticLocation LocationToUnique, const Decl *DeclToUnique, std::unique_ptr< FilesToLineNumsMap > ExecutedLines)
 
 ~PathDiagnostic ()
 
PathPiecesgetActivePath ()
 Return the path currently used by builders for constructing the PathDiagnostic. More...
 
PathPiecesgetMutablePieces ()
 Return a mutable version of 'path'. More...
 
unsigned full_size ()
 Return the unrolled size of the path. More...
 
void pushActivePath (PathPieces *p)
 
void popActivePath ()
 
bool isWithinCall () const
 
void setEndOfPath (std::shared_ptr< PathDiagnosticPiece > EndPiece)
 
void appendToDesc (StringRef S)
 
void resetDiagnosticLocationToMainFile ()
 If the last piece of the report point to the header file, resets the location of the report to be the last location in the main source file. More...
 
StringRef getVerboseDescription () const
 
StringRef getShortDescription () const
 
StringRef getCheckName () const
 
StringRef getBugType () const
 
StringRef getCategory () const
 
const DeclgetDeclWithIssue () const
 Return the semantic context where an issue occurred. More...
 
meta_iterator meta_begin () const
 
meta_iterator meta_end () const
 
void addMeta (StringRef s)
 
filesmap_iterator executedLines_begin () const
 
filesmap_iterator executedLines_end () const
 
PathDiagnosticLocation getLocation () const
 
PathDiagnosticLocation getUniqueingLoc () const
 Get the location on which the report should be uniqued. More...
 
const DeclgetUniqueingDecl () const
 Get the declaration containing the uniqueing location. More...
 
void flattenLocations ()
 
void Profile (llvm::FoldingSetNodeID &ID) const
 Profiles the diagnostic, independent of the path it references. More...
 
void FullProfile (llvm::FoldingSetNodeID &ID) const
 Profiles the diagnostic, including its path. More...
 

Public Attributes

const PathPiecespath
 

Detailed Description

PathDiagnostic - PathDiagnostic objects represent a single path-sensitive diagnostic.

It represents an ordered-collection of PathDiagnosticPieces, each which represent the pieces of the path.

Definition at line 767 of file PathDiagnostic.h.

Member Typedef Documentation

◆ filesmap_iterator

using clang::ento::PathDiagnostic::filesmap_iterator = FilesToLineNumsMap::const_iterator

Definition at line 861 of file PathDiagnostic.h.

◆ meta_iterator

using clang::ento::PathDiagnostic::meta_iterator = std::deque<std::string>::const_iterator

Definition at line 855 of file PathDiagnostic.h.

Constructor & Destructor Documentation

◆ PathDiagnostic() [1/2]

clang::ento::PathDiagnostic::PathDiagnostic ( )
delete

◆ PathDiagnostic() [2/2]

PathDiagnostic::PathDiagnostic ( StringRef  CheckName,
const Decl DeclWithIssue,
StringRef  bugtype,
StringRef  verboseDesc,
StringRef  shortDesc,
StringRef  category,
PathDiagnosticLocation  LocationToUnique,
const Decl DeclToUnique,
std::unique_ptr< FilesToLineNumsMap ExecutedLines 
)

Definition at line 131 of file PathDiagnostic.cpp.

◆ ~PathDiagnostic()

PathDiagnostic::~PathDiagnostic ( )
default

Member Function Documentation

◆ addMeta()

void clang::ento::PathDiagnostic::addMeta ( StringRef  s)
inline

Definition at line 859 of file PathDiagnostic.h.

◆ appendToDesc()

void clang::ento::PathDiagnostic::appendToDesc ( StringRef  S)
inline

Definition at line 829 of file PathDiagnostic.h.

Referenced by resetDiagnosticLocationToMainFile().

◆ executedLines_begin()

filesmap_iterator clang::ento::PathDiagnostic::executedLines_begin ( ) const
inline

Definition at line 863 of file PathDiagnostic.h.

◆ executedLines_end()

filesmap_iterator clang::ento::PathDiagnostic::executedLines_end ( ) const
inline

Definition at line 867 of file PathDiagnostic.h.

◆ flattenLocations()

void clang::ento::PathDiagnostic::flattenLocations ( )
inline

Definition at line 883 of file PathDiagnostic.h.

References clang::ento::PathDiagnosticLocation::flatten().

◆ full_size()

unsigned PathDiagnostic::full_size ( )

Return the unrolled size of the path.

Definition at line 1195 of file PathDiagnostic.cpp.

References compute_path_size(), and path.

◆ FullProfile()

void PathDiagnostic::FullProfile ( llvm::FoldingSetNodeID &  ID) const

Profiles the diagnostic, including its path.

Two diagnostics with the same issue along different paths will generate different profiles.

Definition at line 1257 of file PathDiagnostic.cpp.

References Profile().

◆ getActivePath()

PathPieces& clang::ento::PathDiagnostic::getActivePath ( )
inline

Return the path currently used by builders for constructing the PathDiagnostic.

Definition at line 803 of file PathDiagnostic.h.

Referenced by generateMinimalDiagForBlockEdge(), and generatePathDiagnosticsForNode().

◆ getBugType()

StringRef clang::ento::PathDiagnostic::getBugType ( ) const
inline

Definition at line 847 of file PathDiagnostic.h.

Referenced by compare().

◆ getCategory()

StringRef clang::ento::PathDiagnostic::getCategory ( ) const
inline

Definition at line 848 of file PathDiagnostic.h.

References Category.

Referenced by compare().

◆ getCheckName()

StringRef clang::ento::PathDiagnostic::getCheckName ( ) const
inline

Definition at line 846 of file PathDiagnostic.h.

◆ getDeclWithIssue()

const Decl* clang::ento::PathDiagnostic::getDeclWithIssue ( ) const
inline

Return the semantic context where an issue occurred.

If the issue occurs along a path, this represents the "central" area where the bug manifests.

Definition at line 853 of file PathDiagnostic.h.

Referenced by compare().

◆ getLocation()

PathDiagnosticLocation clang::ento::PathDiagnostic::getLocation ( ) const
inline

◆ getMutablePieces()

PathPieces& clang::ento::PathDiagnostic::getMutablePieces ( )
inline

Return a mutable version of 'path'.

Definition at line 810 of file PathDiagnostic.h.

◆ getShortDescription()

StringRef clang::ento::PathDiagnostic::getShortDescription ( ) const
inline

Definition at line 842 of file PathDiagnostic.h.

Referenced by compare().

◆ getUniqueingDecl()

const Decl* clang::ento::PathDiagnostic::getUniqueingDecl ( ) const
inline

Get the declaration containing the uniqueing location.

Definition at line 879 of file PathDiagnostic.h.

◆ getUniqueingLoc()

PathDiagnosticLocation clang::ento::PathDiagnostic::getUniqueingLoc ( ) const
inline

Get the location on which the report should be uniqued.

Definition at line 874 of file PathDiagnostic.h.

◆ getVerboseDescription()

StringRef clang::ento::PathDiagnostic::getVerboseDescription ( ) const
inline

Definition at line 840 of file PathDiagnostic.h.

Referenced by compare(), and showRelevantLinesJavascript().

◆ isWithinCall()

bool clang::ento::PathDiagnostic::isWithinCall ( ) const
inline

Definition at line 820 of file PathDiagnostic.h.

Referenced by generatePathDiagnosticsForNode().

◆ meta_begin()

meta_iterator clang::ento::PathDiagnostic::meta_begin ( ) const
inline

Definition at line 857 of file PathDiagnostic.h.

Referenced by compare().

◆ meta_end()

meta_iterator clang::ento::PathDiagnostic::meta_end ( ) const
inline

Definition at line 858 of file PathDiagnostic.h.

Referenced by compare().

◆ popActivePath()

void clang::ento::PathDiagnostic::popActivePath ( )
inline

Definition at line 818 of file PathDiagnostic.h.

Referenced by generatePathDiagnosticsForNode().

◆ Profile()

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

Profiles the diagnostic, independent of the path it references.

This can be used to merge diagnostics that refer to the same issue along different paths.

Definition at line 1250 of file PathDiagnostic.cpp.

References getLocation().

Referenced by FullProfile().

◆ pushActivePath()

void clang::ento::PathDiagnostic::pushActivePath ( PathPieces p)
inline

Definition at line 817 of file PathDiagnostic.h.

Referenced by generatePathDiagnosticsForNode().

◆ resetDiagnosticLocationToMainFile()

void PathDiagnostic::resetDiagnosticLocationToMainFile ( )

If the last piece of the report point to the header file, resets the location of the report to be the last location in the main source file.

Definition at line 173 of file PathDiagnostic.cpp.

References appendToDesc(), getFirstStackedCallToHeaderFile(), clang::ento::PathDiagnosticPiece::getLocation(), clang::ento::PathDiagnosticLocation::getManager(), and path.

◆ setEndOfPath()

void clang::ento::PathDiagnostic::setEndOfPath ( std::shared_ptr< PathDiagnosticPiece EndPiece)
inline

Definition at line 822 of file PathDiagnostic.h.

References clang::ento::PathDiagnosticLocation::isValid().

Member Data Documentation

◆ path

const PathPieces& clang::ento::PathDiagnostic::path

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