clang  6.0.0svn
Public Types | Public Member Functions | Friends | List of all members
clang::CXXBasePaths Class Reference

BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases. More...

#include "clang/AST/CXXInheritance.h"

Public Types

typedef std::list< CXXBasePath >::iterator paths_iterator
 
typedef std::list< CXXBasePath >::const_iterator const_paths_iterator
 
typedef NamedDecl ** decl_iterator
 
typedef llvm::iterator_range< decl_iteratordecl_range
 

Public Member Functions

 CXXBasePaths (bool FindAmbiguities=true, bool RecordPaths=true, bool DetectVirtual=true)
 BasePaths - Construct a new BasePaths structure to record the paths for a derived-to-base search. More...
 
paths_iterator begin ()
 
paths_iterator end ()
 
const_paths_iterator begin () const
 
const_paths_iterator end () const
 
CXXBasePathfront ()
 
const CXXBasePathfront () const
 
decl_range found_decls ()
 
bool isAmbiguous (CanQualType BaseType)
 Determine whether the path from the most-derived type to the given base type is ambiguous (i.e., it refers to multiple subobjects of the same base type). More...
 
bool isFindingAmbiguities () const
 Whether we are finding multiple paths to detect ambiguities. More...
 
bool isRecordingPaths () const
 Whether we are recording paths. More...
 
void setRecordingPaths (bool RP)
 Specify whether we should be recording paths or not. More...
 
bool isDetectingVirtual () const
 Whether we are detecting virtual bases. More...
 
const RecordTypegetDetectedVirtual () const
 The virtual base discovered on the path (if we are merely detecting virtuals). More...
 
CXXRecordDeclgetOrigin () const
 Retrieve the type from which this base-paths search began. More...
 
void setOrigin (CXXRecordDecl *Rec)
 
void clear ()
 Clear the base-paths results. More...
 
void swap (CXXBasePaths &Other)
 Swap this data structure's contents with another CXXBasePaths object. More...
 

Friends

class CXXRecordDecl
 

Detailed Description

BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases.

For example, given the following class hierarchy:

class A { };
class B : public A { };
class C : public A { };
class D : public B, public C{ };

There are two potential BasePaths to represent paths from D to a base subobject of type A. One path is (D,0) -> (B,0) -> (A,0) and another is (D,0)->(C,0)->(A,1). These two paths actually refer to two different base class subobjects of the same type, so the BasePaths object refers to an ambiguous path. On the other hand, consider the following class hierarchy:

class A { };
class B : public virtual A { };
class C : public virtual A { };
class D : public B, public C{ };

Here, there are two potential BasePaths again, (D, 0) -> (B, 0) -> (A,v) and (D, 0) -> (C, 0) -> (A, v), but since both of them refer to the same base class subobject of type A (the virtual one), there is no ambiguity.

Definition at line 115 of file CXXInheritance.h.

Member Typedef Documentation

◆ const_paths_iterator

typedef std::list<CXXBasePath>::const_iterator clang::CXXBasePaths::const_paths_iterator

Definition at line 173 of file CXXInheritance.h.

◆ decl_iterator

Definition at line 174 of file CXXInheritance.h.

◆ decl_range

typedef llvm::iterator_range<decl_iterator> clang::CXXBasePaths::decl_range

Definition at line 192 of file CXXInheritance.h.

◆ paths_iterator

typedef std::list<CXXBasePath>::iterator clang::CXXBasePaths::paths_iterator

Definition at line 172 of file CXXInheritance.h.

Constructor & Destructor Documentation

◆ CXXBasePaths()

clang::CXXBasePaths::CXXBasePaths ( bool  FindAmbiguities = true,
bool  RecordPaths = true,
bool  DetectVirtual = true 
)
inlineexplicit

BasePaths - Construct a new BasePaths structure to record the paths for a derived-to-base search.

Definition at line 178 of file CXXInheritance.h.

Member Function Documentation

◆ begin() [1/2]

paths_iterator clang::CXXBasePaths::begin ( )
inline

◆ begin() [2/2]

const_paths_iterator clang::CXXBasePaths::begin ( ) const
inline

Definition at line 186 of file CXXInheritance.h.

◆ clear()

void CXXBasePaths::clear ( )

Clear the base-paths results.

clear - Clear out all prior path information.

Definition at line 57 of file CXXInheritance.cpp.

References clang::CXXBasePath::clear().

Referenced by clang::Sema::CheckExceptionSpecSubset(), and TryStaticDowncast().

◆ end() [1/2]

paths_iterator clang::CXXBasePaths::end ( )
inline

◆ end() [2/2]

const_paths_iterator clang::CXXBasePaths::end ( ) const
inline

Definition at line 187 of file CXXInheritance.h.

◆ found_decls()

CXXBasePaths::decl_range CXXBasePaths::found_decls ( )

Definition at line 38 of file CXXInheritance.cpp.

◆ front() [1/2]

CXXBasePath& clang::CXXBasePaths::front ( )
inline

◆ front() [2/2]

const CXXBasePath& clang::CXXBasePaths::front ( ) const
inline

Definition at line 190 of file CXXInheritance.h.

◆ getDetectedVirtual()

const RecordType* clang::CXXBasePaths::getDetectedVirtual ( ) const
inline

The virtual base discovered on the path (if we are merely detecting virtuals).

Definition at line 214 of file CXXInheritance.h.

Referenced by TryStaticDowncast().

◆ getOrigin()

CXXRecordDecl* clang::CXXBasePaths::getOrigin ( ) const
inline

Retrieve the type from which this base-paths search began.

Definition at line 220 of file CXXInheritance.h.

◆ isAmbiguous()

bool CXXBasePaths::isAmbiguous ( CanQualType  BaseType)

Determine whether the path from the most-derived type to the given base type is ambiguous (i.e., it refers to multiple subobjects of the same base type).

isAmbiguous - Determines whether the set of paths provided is ambiguous, i.e., there are two or more paths that refer to different base class subobjects of the same type.

BaseType must be an unqualified, canonical class type.

Definition at line 50 of file CXXInheritance.cpp.

References clang::CanQual< T >::getUnqualifiedType().

Referenced by adjustReturnValue(), buildDeclareReductionRef(), clang::Sema::CheckExceptionSpecSubset(), and TryStaticDowncast().

◆ isDetectingVirtual()

bool clang::CXXBasePaths::isDetectingVirtual ( ) const
inline

Whether we are detecting virtual bases.

Definition at line 210 of file CXXInheritance.h.

◆ isFindingAmbiguities()

bool clang::CXXBasePaths::isFindingAmbiguities ( ) const
inline

Whether we are finding multiple paths to detect ambiguities.

Definition at line 201 of file CXXInheritance.h.

Referenced by clang::CXXRecordDecl::lookupInBases().

◆ isRecordingPaths()

bool clang::CXXBasePaths::isRecordingPaths ( ) const
inline

Whether we are recording paths.

Definition at line 204 of file CXXInheritance.h.

Referenced by clang::Sema::BuildBasePathArray(), clang::CXXRecordDecl::lookupInBases(), and TryStaticDowncast().

◆ setOrigin()

void clang::CXXBasePaths::setOrigin ( CXXRecordDecl Rec)
inline

◆ setRecordingPaths()

void clang::CXXBasePaths::setRecordingPaths ( bool  RP)
inline

Specify whether we should be recording paths or not.

Definition at line 207 of file CXXInheritance.h.

Referenced by TryStaticDowncast().

◆ swap()

void CXXBasePaths::swap ( CXXBasePaths Other)

Swap this data structure's contents with another CXXBasePaths object.

Swaps the contents of this CXXBasePaths structure with the contents of Other.

Definition at line 67 of file CXXInheritance.cpp.

Referenced by clang::LookupResult::setAmbiguousBaseSubobjects(), and clang::LookupResult::setAmbiguousBaseSubobjectTypes().

Friends And Related Function Documentation

◆ CXXRecordDecl

friend class CXXRecordDecl
friend

Definition at line 163 of file CXXInheritance.h.


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