A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://clang.llvm.org/doxygen/CXXInheritance_8cpp_source.html below:

clang: lib/AST/CXXInheritance.cpp Source File

23#include "llvm/ADT/DenseMap.h" 24#include "llvm/ADT/STLExtras.h" 25#include "llvm/ADT/SmallVector.h" 26#include "llvm/ADT/iterator_range.h" 32using namespace clang

;

40

IsVirtBaseAndNumberNonVirtBases Subobjects = ClassSubobjects[BaseType];

41 return

Subobjects.NumberOfNonVirtBases + (Subobjects.IsVirtBase ? 1 : 0) > 1;

47

ClassSubobjects.clear();

48

VisitedDependentRecords.clear();

49

ScratchPath.

clear

();

50

DetectedVirtual =

nullptr

;

56

std::swap(Origin,

Other

.Origin);

57

Paths.swap(

Other

.Paths);

58

ClassSubobjects.swap(

Other

.ClassSubobjects);

59

VisitedDependentRecords.swap(

Other

.VisitedDependentRecords);

60

std::swap(FindAmbiguities,

Other

.FindAmbiguities);

61

std::swap(RecordPaths,

Other

.RecordPaths);

62

std::swap(DetectVirtual,

Other

.DetectVirtual);

63

std::swap(DetectedVirtual,

Other

.DetectedVirtual);

111 return Base

->getCanonicalDecl() != TargetDecl;

120 if

(CurContext->

Equals

(

this

))

131 for

(

const auto

&I :

Record

->bases()) {

139

(

Base

->isDependentContext() &&

144

Queue.push_back(

Base

);

145 if

(!BaseMatches(

Base

))

151 Record

= Queue.pop_back_val();

157bool

CXXBasePaths::lookupInBases(

ASTContext

&Context,

160 bool

LookupInDependent) {

161 bool

FoundPath =

false

;

165 bool

IsFirstStep = ScratchPath.empty();

167 for

(

const auto

&BaseSpec :

Record

->bases()) {

172 bool

isCurrentInstantiation = isa<InjectedClassNameType>(BaseType);

173 if

(!isCurrentInstantiation) {

174 if

(

auto

*BaseRecord = cast_if_present<CXXRecordDecl>(

175

BaseSpec.getType()->getAsRecordDecl()))

176

isCurrentInstantiation = BaseRecord->isDependentContext() &&

177

BaseRecord->isCurrentInstantiation(

Record

);

185 if

(!LookupInDependent &&

191

IsVirtBaseAndNumberNonVirtBases &Subobjects = ClassSubobjects[BaseType];

192 bool

VisitBase =

true

;

193 bool

SetVirtual =

false

;

194 if

(BaseSpec.isVirtual()) {

195

VisitBase = !Subobjects.IsVirtBase;

196

Subobjects.IsVirtBase =

true

;

204

++Subobjects.NumberOfNonVirtBases;

209

Element.Base = &BaseSpec;

211 if

(BaseSpec.isVirtual())

212

Element.SubobjectNumber = 0;

214

Element.SubobjectNumber = Subobjects.NumberOfNonVirtBases;

215

ScratchPath.push_back(Element);

233

ScratchPath.

Access

= BaseSpec.getAccessSpecifier();

236

BaseSpec.getAccessSpecifier());

240 bool

FoundPathThroughBase =

false

;

242 if

(BaseMatches(&BaseSpec, ScratchPath)) {

244

FoundPath = FoundPathThroughBase =

true

;

247

Paths.push_back(ScratchPath);

253

}

else if

(VisitBase) {

255 if

(LookupInDependent) {

259 if

(

auto

*RT = BaseSpec.getType()->getAs<

RecordType

>())

260

BaseRecord = cast<CXXRecordDecl>(RT->getDecl());

265

BaseRecord = TD->getTemplatedDecl();

269

BaseRecord =

nullptr

;

270 else if

(!VisitedDependentRecords.insert(BaseRecord).second)

271

BaseRecord =

nullptr

;

274

BaseRecord = cast<CXXRecordDecl>(BaseSpec.getType()->getAsRecordDecl());

277

lookupInBases(Context, BaseRecord, BaseMatches, LookupInDependent)) {

286

FoundPath = FoundPathThroughBase =

true

;

295

ScratchPath.pop_back();

299 if

(SetVirtual && !FoundPathThroughBase) {

300

DetectedVirtual =

nullptr

;

305

ScratchPath.

Access

= AccessToHere;

312 bool

LookupInDependent)

const

{

314 if

(!Paths.lookupInBases(

getASTContext

(),

this

, BaseMatches,

320 if

(!Paths.isRecordingPaths() || !Paths.isFindingAmbiguities())

335 if

(!PE.Base->isVirtual())

340

VBase = cast<CXXRecordDecl>(

Record

->getDecl());

352

HidingClass = cast<CXXRecordDecl>(

Record

->getDecl());

370 "User data for FindBaseClass is not canonical!"

);

372

->getCanonicalDecl() == BaseRecord;

379 "User data for FindBaseClass is not canonical!"

);

382

->getCanonicalDecl() == BaseRecord;

437

llvm::function_ref<

bool

(

const NamedDecl

*ND)> Filter) {

438

std::vector<const NamedDecl *> Results;

440 bool

AnyOrdinaryMembers =

false

;

443

AnyOrdinaryMembers =

true

;

445

Results.push_back(ND);

447 if

(AnyOrdinaryMembers)

452

Paths.setOrigin(

this

);

462

Results.push_back(*I);

470

= Overrides[OverriddenSubobject];

471 if

(!llvm::is_contained(SubobjectOverrides, Overriding))

472

SubobjectOverrides.push_back(Overriding);

478

MEnd = I->second.end();

488

I->second.push_back(Overriding);

494class

FinalOverriderCollector {

497

llvm::DenseMap<const CXXRecordDecl *, unsigned> SubobjectCount;

500

llvm::DenseMap<const CXXRecordDecl *, CXXFinalOverriderMap *> VirtualOverriders;

505

~FinalOverriderCollector();

514void

FinalOverriderCollector::Collect(

const CXXRecordDecl

*RD,

518 unsigned

SubobjectNumber = 0;

523 for

(

const auto

&

Base

: RD->

bases

()) {

525 const CXXRecordDecl

*BaseDecl = cast<CXXRecordDecl>(RT->getDecl());

529 if

(Overriders.empty() && !

Base

.isVirtual()) {

532

Collect(BaseDecl,

false

, InVirtualSubobject, Overriders);

543 if

(

Base

.isVirtual()) {

545

BaseOverriders = MyVirtualOverriders;

546 if

(!MyVirtualOverriders) {

552

BaseOverriders = MyVirtualOverriders;

554

Collect(BaseDecl,

true

, BaseDecl, *MyVirtualOverriders);

557

Collect(BaseDecl,

false

, InVirtualSubobject, ComputedBaseOverriders);

561 for

(CXXFinalOverriderMap::iterator OM = BaseOverriders->begin(),

562

OMEnd = BaseOverriders->end();

566

Overriders[CanonOM].add(OM->second);

571 for

(

auto

*M : RD->

methods

()) {

577 using

OverriddenMethodsRange =

578

llvm::iterator_range<CXXMethodDecl::method_iterator>;

581 if

(OverriddenMethods.begin() == OverriddenMethods.end()) {

588

Overriders[CanonM].add(SubobjectNumber,

590

InVirtualSubobject));

601 while

(!Stack.empty()) {

614

Overriders[CanonOM].replaceAll(

616

InVirtualSubobject));

619 if

(OverriddenMethods.begin() == OverriddenMethods.end())

624

Stack.push_back(OverriddenMethods);

630

Overriders[CanonM].add(SubobjectNumber,

632

InVirtualSubobject));

636

FinalOverriderCollector::~FinalOverriderCollector() {

637 for

(llvm::DenseMap<const CXXRecordDecl *, CXXFinalOverriderMap *>::iterator

638

VO = VirtualOverriders.begin(), VOEnd = VirtualOverriders.end();

646

FinalOverriderCollector Collector;

647

Collector.Collect(

this

,

false

,

nullptr

, FinalOverriders);

652 for

(

auto

&OM : FinalOverriders) {

653 for

(

auto

&SO : OM.second) {

655 if

(Overriding.size() < 2)

659 if

(!M.InVirtualSubobject)

669

OP.Method->getParent()->isVirtuallyDerivedFrom(

670

M.InVirtualSubobject))

677

llvm::erase_if(Overriding, IsHidden);

690 for

(

const auto

&I : RD->

bases

()) {

691

assert(!I.getType()->isDependentType() &&

692 "Cannot get indirect primary bases for class with dependent bases."

);

695

cast<CXXRecordDecl>(I.getType()->getAsRecordDecl());

712 for

(

const auto

&I :

bases

()) {

713

assert(!I.getType()->isDependentType() &&

714 "Cannot get indirect primary bases for class with dependent bases."

);

717

cast<CXXRecordDecl>(I.getType()->getAsRecordDecl());

Defines the clang::ASTContext interface.

static bool findOrdinaryMemberInDependentClasses(const CXXBaseSpecifier *Specifier, CXXBasePath &Path, DeclarationName Name)

static void AddIndirectPrimaryBases(const CXXRecordDecl *RD, ASTContext &Context, CXXIndirectPrimaryBaseSet &Bases)

static bool isOrdinaryMember(const NamedDecl *ND)

static bool findOrdinaryMember(const CXXRecordDecl *RD, CXXBasePath &Path, DeclarationName Name)

Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....

Defines the C++ template declaration subclasses.

Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.

llvm::MachO::Record Record

static RecordDecl * getAsRecordDecl(QualType BaseType)

C Language Family Type Representation.

const NestedNameSpecifier * Specifier

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const

Get or compute information about the layout of the specified record (struct/union/class) D,...

CanQualType getCanonicalType(QualType T) const

Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...

ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...

const CXXRecordDecl * getPrimaryBase() const

getPrimaryBase - Get the primary base for this record.

bool isPrimaryBaseVirtual() const

isPrimaryBaseVirtual - Get whether the primary base for this record is virtual or not.

Represents a path from a specific derived class (which is not represented as part of the path) to a p...

AccessSpecifier Access

The access along this inheritance path.

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

bool isRecordingPaths() const

Whether we are recording paths.

bool isDetectingVirtual() const

Whether we are detecting virtual bases.

bool isAmbiguous(CanQualType BaseType)

Determine whether the path from the most-derived type to the given base type is ambiguous (i....

void clear()

Clear the base-paths results.

bool isFindingAmbiguities() const

Whether we are finding multiple paths to detect ambiguities.

void swap(CXXBasePaths &Other)

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

Represents a base class of a C++ class.

A mapping from each virtual member function to its set of final overriders.

A set of all the primary bases for a class.

Represents a static or instance method of a struct/union/class.

overridden_method_range overridden_methods() const

CXXMethodDecl * getCanonicalDecl() override

Retrieves the "canonical" declaration of the given declaration.

Represents a C++ struct/union/class.

void getIndirectPrimaryBases(CXXIndirectPrimaryBaseSet &Bases) const

Get the indirect primary bases for this class.

bool isProvablyNotDerivedFrom(const CXXRecordDecl *Base) const

Determine whether this class is provably not derived from the type Base.

method_range methods() const

static AccessSpecifier MergeAccess(AccessSpecifier PathAccess, AccessSpecifier DeclAccess)

Calculates the access of a decl that is reached along a path.

bool isPolymorphic() const

Whether this class is polymorphic (C++ [class.virtual]), which means that the class contains or inher...

bool lookupInBases(BaseMatchesCallback BaseMatches, CXXBasePaths &Paths, bool LookupInDependent=false) const

Look for entities within the base classes of this C++ class, transitively searching all base class su...

bool hasDefinition() const

void getFinalOverriders(CXXFinalOverriderMap &FinaOverriders) const

Retrieve the final overriders for each virtual member function in the class hierarchy where this clas...

llvm::function_ref< bool(const CXXBaseSpecifier *Specifier, CXXBasePath &Path)> BaseMatchesCallback

Function type used by lookupInBases() to determine whether a specific base class subobject matches th...

bool isCurrentInstantiation(const DeclContext *CurContext) const

Determine whether this dependent class is a current instantiation, when viewed from within the given ...

bool hasMemberName(DeclarationName N) const

Determine whether this class has a member with the given name, possibly in a non-dependent base class...

llvm::function_ref< bool(const CXXRecordDecl *BaseDefinition)> ForallBasesCallback

Function type used by forallBases() as a callback.

static bool FindVirtualBaseClass(const CXXBaseSpecifier *Specifier, CXXBasePath &Path, const CXXRecordDecl *BaseRecord)

Base-class lookup callback that determines whether the given base class specifier refers to a specifi...

static bool FindBaseClass(const CXXBaseSpecifier *Specifier, CXXBasePath &Path, const CXXRecordDecl *BaseRecord)

Base-class lookup callback that determines whether the given base class specifier refers to a specifi...

bool isVirtuallyDerivedFrom(const CXXRecordDecl *Base) const

Determine whether this class is virtually derived from the class Base.

bool forallBases(ForallBasesCallback BaseMatches) const

Determines if the given callback holds for all the direct or indirect base classes of this type.

std::vector< const NamedDecl * > lookupDependentName(DeclarationName Name, llvm::function_ref< bool(const NamedDecl *ND)> Filter)

Performs an imprecise lookup of a dependent name in this class.

CXXRecordDecl * getCanonicalDecl() override

Retrieves the "canonical" declaration of the given declaration.

unsigned getNumVBases() const

Retrieves the number of virtual base classes of this class.

bool isDerivedFrom(const CXXRecordDecl *Base) const

Determine whether this class is derived from the class Base.

CanQual< T > getUnqualifiedType() const

Retrieve the unqualified form of this type.

DeclContext - This is used only as base class of specific decl types that can act as declaration cont...

DeclContext * getParent()

getParent - Returns the containing DeclContext.

bool Equals(const DeclContext *DC) const

Determine whether this declaration context is equivalent to the declaration context DC.

bool isFileContext() const

bool isDependentContext() const

Determines whether this context is dependent on a template parameter.

lookup_result lookup(DeclarationName Name) const

lookup - Find the declarations (if any) with the given Name in this context.

ASTContext & getASTContext() const LLVM_READONLY

bool isInIdentifierNamespace(unsigned NS) const

@ IDNS_Ordinary

Ordinary names.

@ IDNS_Member

Members, declared with object declarations within tag definitions.

@ IDNS_Tag

Tags, declared with 'struct foo;' and referenced with 'struct foo'.

The name of a declaration.

This represents a decl that may have a name.

CXXRecordDecl * getAsRecordDecl() const

Retrieve the record declaration stored in this nested name specifier.

The set of methods that override a given virtual method in each subobject where it occurs.

void replaceAll(UniqueVirtualMethod Overriding)

MapType::iterator iterator

SmallVectorImpl< UniqueVirtualMethod >::const_iterator overriding_const_iterator

MapType::const_iterator const_iterator

void add(unsigned OverriddenSubobject, UniqueVirtualMethod Overriding)

A (possibly-)qualified type.

RecordDecl * getDefinition() const

Returns the RecordDecl that actually defines this struct/union/class.

A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...

RecordDecl * getDecl() const

Represents a C++ template name within the type system.

TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const

Retrieve the underlying template declaration that this template name refers to, if known.

Represents a type template specialization; the template must be a class template, a type alias templa...

TemplateName getTemplateName() const

Retrieve the name of the template that we are specializing.

bool isDependentType() const

Whether this type is a dependent type, meaning that its definition somehow depends on a template para...

const T * getAs() const

Member-template getAs<specific type>'.

The JSON file list parser is used to communicate input to InstallAPI.

if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))

@ Other

Other implicit parameter.

AccessSpecifier

A C++ access specifier (public, private, protected), plus the special value "none" which means differ...

Represents an element in a path from a derived class to a base class.

Uniquely identifies a virtual method within a class hierarchy by the method itself and a class subobj...


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4