diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-02-11 01:04:33 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-02-11 01:04:33 +0000 |
commit | 952b017601f9c82b51119c3a1600f1312a833db9 (patch) | |
tree | e913763a3dc0603cf52a20c3f28557ac34cd2f95 | |
parent | 298ed870c7d8edf243edf14d624e577d4a3a8800 (diff) |
Eliminate the ASTContext parameter from RecordDecl::getDefinition()
and CXXRecordDecl::getDefinition(); it's totally unnecessary. No
functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95836 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/Decl.h | 6 | ||||
-rw-r--r-- | include/clang/AST/DeclCXX.h | 2 | ||||
-rw-r--r-- | lib/AST/ASTContext.cpp | 4 | ||||
-rw-r--r-- | lib/AST/ASTImporter.cpp | 2 | ||||
-rw-r--r-- | lib/AST/CXXInheritance.cpp | 3 | ||||
-rw-r--r-- | lib/AST/Decl.cpp | 2 | ||||
-rw-r--r-- | lib/Checker/MemRegion.cpp | 2 | ||||
-rw-r--r-- | lib/Checker/RegionStore.cpp | 2 | ||||
-rw-r--r-- | lib/Checker/Store.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 2 | ||||
-rw-r--r-- | lib/Frontend/ASTConsumers.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaCXXCast.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 16 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 8 | ||||
-rw-r--r-- | tools/CIndex/CIndex.cpp | 4 |
18 files changed, 33 insertions, 34 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 58fb01d4fc..6d495522ca 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -1595,7 +1595,7 @@ public: /// specific TagDecl is defining declaration, not whether or not the /// struct/union/class/enum type is defined. This method returns NULL if /// there is no TagDecl that defines the struct/union/class/enum. - TagDecl* getDefinition(ASTContext& C) const; + TagDecl* getDefinition() const; void setDefinition(bool V) { IsDefinition = V; } @@ -1801,8 +1801,8 @@ public: /// RecordDecl is defining declaration, not whether or not the record /// type is defined. This method returns NULL if there is no RecordDecl /// that defines the struct/union/tag. - RecordDecl* getDefinition(ASTContext& C) const { - return cast_or_null<RecordDecl>(TagDecl::getDefinition(C)); + RecordDecl* getDefinition() const { + return cast_or_null<RecordDecl>(TagDecl::getDefinition()); } // Iterator access to field members. The field iterator only visits diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index c0790f33b8..a3a66885c2 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -362,7 +362,7 @@ public: return cast<CXXRecordDecl>(RecordDecl::getCanonicalDecl()); } - CXXRecordDecl *getDefinition(ASTContext& C) const { + CXXRecordDecl *getDefinition() const { if (!DefinitionData) return 0; return data().Definition; } diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 7912a93421..982ca7faa1 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1097,7 +1097,7 @@ ASTContext::getASTObjCImplementationLayout(const ObjCImplementationDecl *D) { /// specified record (struct/union/class), which indicates its size and field /// position information. const ASTRecordLayout &ASTContext::getASTRecordLayout(const RecordDecl *D) { - D = D->getDefinition(*this); + D = D->getDefinition(); assert(D && "Cannot get layout of forward declarations!"); // Look up this layout, if already laid out, return what we have. @@ -1114,7 +1114,7 @@ const ASTRecordLayout &ASTContext::getASTRecordLayout(const RecordDecl *D) { } const CXXMethodDecl *ASTContext::getKeyFunction(const CXXRecordDecl *RD) { - RD = cast<CXXRecordDecl>(RD->getDefinition(*this)); + RD = cast<CXXRecordDecl>(RD->getDefinition()); assert(RD && "Cannot get key function for forward declarations!"); const CXXMethodDecl *&Entry = KeyFunctions[RD]; diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp index f321ce2b9b..710a4635c1 100644 --- a/lib/AST/ASTImporter.cpp +++ b/lib/AST/ASTImporter.cpp @@ -652,7 +652,7 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) { // If this record has a definition in the translation unit we're coming from, // but this particular declaration is not that definition, import the // definition and map to that. - TagDecl *Definition = D->getDefinition(Importer.getFromContext()); + TagDecl *Definition = D->getDefinition(); if (Definition && Definition != D) { Decl *ImportedDef = Importer.Import(Definition); Importer.getImportedDecls()[D] = ImportedDef; diff --git a/lib/AST/CXXInheritance.cpp b/lib/AST/CXXInheritance.cpp index 7d9e553eaf..99f908caea 100644 --- a/lib/AST/CXXInheritance.cpp +++ b/lib/AST/CXXInheritance.cpp @@ -102,7 +102,6 @@ bool CXXRecordDecl::isProvablyNotDerivedFrom(const CXXRecordDecl *Base) const { bool CXXRecordDecl::forallBases(ForallBasesCallback *BaseMatches, void *OpaqueData, bool AllowShortCircuit) const { - ASTContext &Context = getASTContext(); llvm::SmallVector<const CXXRecordDecl*, 8> Queue; const CXXRecordDecl *Record = this; @@ -118,7 +117,7 @@ bool CXXRecordDecl::forallBases(ForallBasesCallback *BaseMatches, } CXXRecordDecl *Base = - cast_or_null<CXXRecordDecl>(Ty->getDecl()->getDefinition(Context)); + cast_or_null<CXXRecordDecl>(Ty->getDecl()->getDefinition()); if (!Base) { if (AllowShortCircuit) return false; AllMatches = false; diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index a23f28cb37..80c1244698 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -1398,7 +1398,7 @@ void TagDecl::completeDefinition() { } } -TagDecl* TagDecl::getDefinition(ASTContext& C) const { +TagDecl* TagDecl::getDefinition() const { if (isDefinition()) return const_cast<TagDecl *>(this); diff --git a/lib/Checker/MemRegion.cpp b/lib/Checker/MemRegion.cpp index cfa855e195..194015a11b 100644 --- a/lib/Checker/MemRegion.cpp +++ b/lib/Checker/MemRegion.cpp @@ -681,7 +681,7 @@ const MemRegion *MemRegion::StripCasts() const { static bool IsCompleteType(ASTContext &Ctx, QualType Ty) { if (const RecordType *RT = Ty->getAs<RecordType>()) { const RecordDecl *D = RT->getDecl(); - if (!D->getDefinition(Ctx)) + if (!D->getDefinition()) return false; } diff --git a/lib/Checker/RegionStore.cpp b/lib/Checker/RegionStore.cpp index d97fdbb7fd..4a8d9a0b0a 100644 --- a/lib/Checker/RegionStore.cpp +++ b/lib/Checker/RegionStore.cpp @@ -606,7 +606,7 @@ Store InvalidateRegionsWorker::InvalidateRegions(RegionStoreManager &RM, // Invalidate the binding. if (const RecordType *RT = T->getAsStructureType()) { - const RecordDecl *RD = RT->getDecl()->getDefinition(Ctx); + const RecordDecl *RD = RT->getDecl()->getDefinition(); // No record definition. There is nothing we can do. if (!RD) { B = RM.Remove(B, baseR); diff --git a/lib/Checker/Store.cpp b/lib/Checker/Store.cpp index d68369dfa5..e524cb3d7c 100644 --- a/lib/Checker/Store.cpp +++ b/lib/Checker/Store.cpp @@ -31,7 +31,7 @@ const MemRegion *StoreManager::MakeElementRegion(const MemRegion *Base, static bool IsCompleteType(ASTContext &Ctx, QualType Ty) { if (const RecordType *RT = Ty->getAs<RecordType>()) { const RecordDecl *D = RT->getDecl(); - if (!D->getDefinition(Ctx)) + if (!D->getDefinition()) return false; } diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 51f82db61d..620ecc8162 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -799,7 +799,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty, llvm::DIType(), llvm::DIArray()); // If this is just a forward declaration, return it. - if (!RD->getDefinition(CGM.getContext())) + if (!RD->getDefinition()) return FwdDecl; llvm::TrackingVH<llvm::MDNode> FwdDeclNode = FwdDecl.getNode(); diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp index 33cb94e02d..ebbd720ceb 100644 --- a/lib/Frontend/ASTConsumers.cpp +++ b/lib/Frontend/ASTConsumers.cpp @@ -564,7 +564,7 @@ public: if (RD->isInvalidDecl()) continue; - if (!RD->getDefinition(C)) + if (!RD->getDefinition()) continue; // FIXME: Do we really need to hard code this? diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp index 48258ff6ad..0097cd363c 100644 --- a/lib/Sema/SemaCXXCast.cpp +++ b/lib/Sema/SemaCXXCast.cpp @@ -391,7 +391,7 @@ CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType, } // C++ 5.2.7p6: Otherwise, v shall be [polymorphic]. - const RecordDecl *SrcDecl = SrcRecord->getDecl()->getDefinition(Self.Context); + const RecordDecl *SrcDecl = SrcRecord->getDecl()->getDefinition(); assert(SrcDecl && "Definition missing"); if (!cast<CXXRecordDecl>(SrcDecl)->isPolymorphic()) { Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_polymorphic) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index e12902bff6..82fd4379f6 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -4633,7 +4633,7 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, // Diagnose attempts to redefine a tag. if (TUK == TUK_Definition) { - if (TagDecl *Def = PrevTagDecl->getDefinition(Context)) { + if (TagDecl *Def = PrevTagDecl->getDefinition()) { // If we're defining a specialization and the previous definition // is from an implicit instantiation, don't emit an error // here; we'll catch this in the general case below. diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index b42a27cdcb..2653633a95 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -486,7 +486,7 @@ Sema::CheckBaseSpecifier(CXXRecordDecl *Class, // If the base class is polymorphic or isn't empty, the new one is/isn't, too. RecordDecl *BaseDecl = BaseType->getAs<RecordType>()->getDecl(); assert(BaseDecl && "Record type has no declaration"); - BaseDecl = BaseDecl->getDefinition(Context); + BaseDecl = BaseDecl->getDefinition(); assert(BaseDecl && "Base type is not incomplete, but has no definition"); CXXRecordDecl * CXXBaseDecl = cast<CXXRecordDecl>(BaseDecl); assert(CXXBaseDecl && "Base type is not a C++ type"); @@ -2013,7 +2013,7 @@ bool Sema::RequireNonAbstractType(SourceLocation Loc, QualType T, return false; // FIXME: is this reasonable? It matches current behavior, but.... - if (!RD->getDefinition(Context)) + if (!RD->getDefinition()) return false; if (!RD->isAbstract()) diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 044216381c..c12c7776ee 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -747,7 +747,7 @@ static bool IsProvablyNotDerivedFrom(Sema &SemaRef, if (Bases.count(Record->getCanonicalDecl())) return false; - RecordDecl *RD = Record->getDefinition(SemaRef.Context); + RecordDecl *RD = Record->getDefinition(); if (!RD) return false; Record = cast<CXXRecordDecl>(RD); diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 1779bde666..83bc6f39b8 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -823,7 +823,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, // Check for redefinition of this class template. if (TUK == TUK_Definition) { - if (TagDecl *Def = PrevRecordDecl->getDefinition(Context)) { + if (TagDecl *Def = PrevRecordDecl->getDefinition()) { Diag(NameLoc, diag::err_redefinition) << Name; Diag(Def->getLocation(), diag::note_previous_definition); // FIXME: Would it make sense to try to "forget" the previous @@ -3568,7 +3568,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, // Check that this isn't a redefinition of this specialization. if (TUK == TUK_Definition) { - if (RecordDecl *Def = Specialization->getDefinition(Context)) { + if (RecordDecl *Def = Specialization->getDefinition()) { SourceRange Range(TemplateNameLoc, RAngleLoc); Diag(TemplateNameLoc, diag::err_redefinition) << Context.getTypeDeclType(Specialization) << Range; @@ -4325,13 +4325,13 @@ Sema::ActOnExplicitInstantiation(Scope *S, // instantiation. ClassTemplateSpecializationDecl *Def = cast_or_null<ClassTemplateSpecializationDecl>( - Specialization->getDefinition(Context)); + Specialization->getDefinition()); if (!Def) InstantiateClassTemplateSpecialization(TemplateNameLoc, Specialization, TSK); // Instantiate the members of this class template specialization. Def = cast_or_null<ClassTemplateSpecializationDecl>( - Specialization->getDefinition(Context)); + Specialization->getDefinition()); if (Def) InstantiateClassTemplateSpecializationMembers(TemplateNameLoc, Def, TSK); @@ -4408,7 +4408,7 @@ Sema::ActOnExplicitInstantiation(Scope *S, // Verify that it is okay to explicitly instantiate here. CXXRecordDecl *PrevDecl = cast_or_null<CXXRecordDecl>(Record->getPreviousDeclaration()); - if (!PrevDecl && Record->getDefinition(Context)) + if (!PrevDecl && Record->getDefinition()) PrevDecl = Record; if (PrevDecl) { MemberSpecializationInfo *MSInfo = PrevDecl->getMemberSpecializationInfo(); @@ -4425,13 +4425,13 @@ Sema::ActOnExplicitInstantiation(Scope *S, } CXXRecordDecl *RecordDef - = cast_or_null<CXXRecordDecl>(Record->getDefinition(Context)); + = cast_or_null<CXXRecordDecl>(Record->getDefinition()); if (!RecordDef) { // C++ [temp.explicit]p3: // A definition of a member class of a class template shall be in scope // at the point of an explicit instantiation of the member class. CXXRecordDecl *Def - = cast_or_null<CXXRecordDecl>(Pattern->getDefinition(Context)); + = cast_or_null<CXXRecordDecl>(Pattern->getDefinition()); if (!Def) { Diag(TemplateLoc, diag::err_explicit_instantiation_undefined_member) << 0 << Record->getDeclName() << Record->getDeclContext(); @@ -4444,7 +4444,7 @@ Sema::ActOnExplicitInstantiation(Scope *S, TSK)) return true; - RecordDef = cast_or_null<CXXRecordDecl>(Record->getDefinition(Context)); + RecordDef = cast_or_null<CXXRecordDecl>(Record->getDefinition()); if (!RecordDef) return true; } diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 99c1de6198..0dd7990f50 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -1054,7 +1054,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, bool Invalid = false; CXXRecordDecl *PatternDef - = cast_or_null<CXXRecordDecl>(Pattern->getDefinition(Context)); + = cast_or_null<CXXRecordDecl>(Pattern->getDefinition()); if (!PatternDef) { if (!Complain) { // Say nothing @@ -1397,8 +1397,8 @@ Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation, CXXRecordDecl *Pattern = Record->getInstantiatedFromMemberClass(); assert(Pattern && "Missing instantiated-from-template information"); - if (!Record->getDefinition(Context)) { - if (!Pattern->getDefinition(Context)) { + if (!Record->getDefinition()) { + if (!Pattern->getDefinition()) { // C++0x [temp.explicit]p8: // An explicit instantiation definition that names a class template // specialization explicitly instantiates the class template @@ -1418,7 +1418,7 @@ Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation, TSK); } - Pattern = cast_or_null<CXXRecordDecl>(Record->getDefinition(Context)); + Pattern = cast_or_null<CXXRecordDecl>(Record->getDefinition()); if (Pattern) InstantiateClassMembers(PointOfInstantiation, Pattern, TemplateArgs, TSK); diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp index 920c5ec070..dc1608bbc8 100644 --- a/tools/CIndex/CIndex.cpp +++ b/tools/CIndex/CIndex.cpp @@ -1719,7 +1719,7 @@ CXCursor clang_getCursorDefinition(CXCursor C) { case Decl::CXXRecord: case Decl::ClassTemplateSpecialization: case Decl::ClassTemplatePartialSpecialization: - if (TagDecl *Def = cast<TagDecl>(D)->getDefinition(D->getASTContext())) + if (TagDecl *Def = cast<TagDecl>(D)->getDefinition()) return MakeCXCursor(Def, CXXUnit); return clang_getNullCursor(); @@ -1750,7 +1750,7 @@ CXCursor clang_getCursorDefinition(CXCursor C) { case Decl::ClassTemplate: { if (RecordDecl *Def = cast<ClassTemplateDecl>(D)->getTemplatedDecl() - ->getDefinition(D->getASTContext())) + ->getDefinition()) return MakeCXCursor( cast<CXXRecordDecl>(Def)->getDescribedClassTemplate(), CXXUnit); |