diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/AST/DeclCXX.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/AST/DeclCXX.cpp | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/contrib/llvm/tools/clang/lib/AST/DeclCXX.cpp b/contrib/llvm/tools/clang/lib/AST/DeclCXX.cpp index d905fcf13a45..4f24fdc28f71 100644 --- a/contrib/llvm/tools/clang/lib/AST/DeclCXX.cpp +++ b/contrib/llvm/tools/clang/lib/AST/DeclCXX.cpp @@ -385,17 +385,11 @@ void CXXRecordDecl::addedClassSubobject(CXXRecordDecl *Subobj) { } } -/// Callback function for CXXRecordDecl::forallBases that acknowledges -/// that it saw a base class. -static bool SawBase(const CXXRecordDecl *, void *) { - return true; -} - bool CXXRecordDecl::hasAnyDependentBases() const { if (!isDependentContext()) return false; - return !forallBases(SawBase, nullptr); + return !forallBases([](const CXXRecordDecl *) { return true; }); } bool CXXRecordDecl::isTriviallyCopyable() const { @@ -1224,6 +1218,10 @@ CXXRecordDecl *CXXRecordDecl::getInstantiatedFromMemberClass() const { return nullptr; } +MemberSpecializationInfo *CXXRecordDecl::getMemberSpecializationInfo() const { + return TemplateOrInstantiation.dyn_cast<MemberSpecializationInfo *>(); +} + void CXXRecordDecl::setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK) { @@ -1234,6 +1232,14 @@ CXXRecordDecl::setInstantiationOfMemberClass(CXXRecordDecl *RD, = new (getASTContext()) MemberSpecializationInfo(RD, TSK); } +ClassTemplateDecl *CXXRecordDecl::getDescribedClassTemplate() const { + return TemplateOrInstantiation.dyn_cast<ClassTemplateDecl *>(); +} + +void CXXRecordDecl::setDescribedClassTemplate(ClassTemplateDecl *Template) { + TemplateOrInstantiation = Template; +} + TemplateSpecializationKind CXXRecordDecl::getTemplateSpecializationKind() const{ if (const ClassTemplateSpecializationDecl *Spec = dyn_cast<ClassTemplateSpecializationDecl>(this)) @@ -1681,8 +1687,8 @@ CXXCtorInitializer::CXXCtorInitializer(ASTContext &Context, LParenLoc(L), RParenLoc(R), IsDelegating(false), IsVirtual(false), IsWritten(false), SourceOrderOrNumArrayIndices(NumIndices) { - VarDecl **MyIndices = reinterpret_cast<VarDecl **> (this + 1); - memcpy(MyIndices, Indices, NumIndices * sizeof(VarDecl *)); + std::uninitialized_copy(Indices, Indices + NumIndices, + getTrailingObjects<VarDecl *>()); } CXXCtorInitializer *CXXCtorInitializer::Create(ASTContext &Context, @@ -1692,8 +1698,7 @@ CXXCtorInitializer *CXXCtorInitializer::Create(ASTContext &Context, SourceLocation R, VarDecl **Indices, unsigned NumIndices) { - void *Mem = Context.Allocate(sizeof(CXXCtorInitializer) + - sizeof(VarDecl *) * NumIndices, + void *Mem = Context.Allocate(totalSizeToAlloc<VarDecl *>(NumIndices), llvm::alignOf<CXXCtorInitializer>()); return new (Mem) CXXCtorInitializer(Context, Member, MemberLoc, L, Init, R, Indices, NumIndices); @@ -2023,6 +2028,22 @@ NamespaceDecl *NamespaceDecl::CreateDeserialized(ASTContext &C, unsigned ID) { SourceLocation(), nullptr, nullptr); } +NamespaceDecl *NamespaceDecl::getOriginalNamespace() { + if (isFirstDecl()) + return this; + + return AnonOrFirstNamespaceAndInline.getPointer(); +} + +const NamespaceDecl *NamespaceDecl::getOriginalNamespace() const { + if (isFirstDecl()) + return this; + + return AnonOrFirstNamespaceAndInline.getPointer(); +} + +bool NamespaceDecl::isOriginalNamespace() const { return isFirstDecl(); } + NamespaceDecl *NamespaceDecl::getNextRedeclarationImpl() { return getNextRedeclaration(); } |