diff options
author | John McCall <rjmccall@apple.com> | 2011-10-07 06:10:15 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-10-07 06:10:15 +0000 |
commit | f937c023bf5da08b0d218d183b0d762c60917794 (patch) | |
tree | bcf1c52d2f5dd732fcc95d110c650e0aaba4189d /clang | |
parent | bf136764ae7ad1e61f703822fc0df9608bd207d7 (diff) | |
download | bcm5719-llvm-f937c023bf5da08b0d218d183b0d762c60917794.tar.gz bcm5719-llvm-f937c023bf5da08b0d218d183b0d762c60917794.zip |
Rename TagDecl::isDefinition -> isCompleteDefinition
for better self-documenting code, since the semantics
are subtly different from getDefinition().
llvm-svn: 141355
Diffstat (limited to 'clang')
25 files changed, 80 insertions, 75 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index 76aad219462..0f65bfbd356 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -2359,9 +2359,10 @@ private: /// TagDeclKind - The TagKind enum. unsigned TagDeclKind : 2; - /// IsDefinition - True if this is a definition ("struct foo {};"), false if - /// it is a declaration ("struct foo;"). - bool IsDefinition : 1; + /// IsCompleteDefinition - True if this is a definition ("struct foo + /// {};"), false if it is a declaration ("struct foo;"). It is not + /// a definition until the definition has been fully processed. + bool IsCompleteDefinition : 1; /// IsBeingDefined - True if this is currently being defined. bool IsBeingDefined : 1; @@ -2421,7 +2422,7 @@ protected: assert((DK != Enum || TK == TTK_Enum) && "EnumDecl not matched with TTK_Enum"); TagDeclKind = TK; - IsDefinition = false; + IsCompleteDefinition = false; IsBeingDefined = false; IsEmbeddedInDeclarator = false; IsFreeStanding = false; @@ -2463,14 +2464,15 @@ public: } /// isThisDeclarationADefinition() - Return true if this declaration - /// defines the type. Provided for consistency. + /// is a completion definintion of the type. Provided for consistency. bool isThisDeclarationADefinition() const { - return isDefinition(); + return isCompleteDefinition(); } - /// isDefinition - Return true if this decl has its body specified. - bool isDefinition() const { - return IsDefinition; + /// isCompleteDefinition - Return true if this decl has its body + /// fully specified. + bool isCompleteDefinition() const { + return IsCompleteDefinition; } /// isBeingDefined - Return true if this decl is currently being defined. @@ -2504,14 +2506,15 @@ public: /// getDefinition - Returns the TagDecl that actually defines this /// struct/union/class/enum. When determining whether or not a - /// struct/union/class/enum is completely defined, one should use this method - /// as opposed to 'isDefinition'. 'isDefinition' indicates whether or not a - /// 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() const; + /// struct/union/class/enum has a definition, one should use this + /// method as opposed to 'isDefinition'. 'isDefinition' indicates + /// whether or not a 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() const; - void setDefinition(bool V) { IsDefinition = V; } + void setCompleteDefinition(bool V) { IsCompleteDefinition = V; } const char *getKindName() const { return TypeWithKeyword::getTagTypeKindName(getTagKind()); @@ -2751,7 +2754,7 @@ public: /// \brief Returns true if this can be considered a complete type. bool isComplete() const { - return isDefinition() || isFixed(); + return isCompleteDefinition() || isFixed(); } /// \brief Returns the enumeration (declared within the template) @@ -2854,14 +2857,15 @@ public: /// \endcode bool isInjectedClassName() const; - /// getDefinition - Returns the RecordDecl that actually defines this - /// struct/union/class. When determining whether or not a struct/union/class - /// is completely defined, one should use this method as opposed to - /// 'isDefinition'. 'isDefinition' indicates whether or not a specific - /// 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() const { + /// getDefinition - Returns the RecordDecl that actually defines + /// this struct/union/class. When determining whether or not a + /// struct/union/class is completely defined, one should use this + /// method as opposed to 'isCompleteDefinition'. + /// 'isCompleteDefinition' indicates whether or not a specific + /// RecordDecl is a completed definition, 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() const { return cast_or_null<RecordDecl>(TagDecl::getDefinition()); } diff --git a/clang/include/clang/AST/TypeLoc.h b/clang/include/clang/AST/TypeLoc.h index 02ced65e5c5..20acadab7cf 100644 --- a/clang/include/clang/AST/TypeLoc.h +++ b/clang/include/clang/AST/TypeLoc.h @@ -568,7 +568,7 @@ public: /// \brief True if the tag was defined in this type specifier. bool isDefinition() const { - return getDecl()->isDefinition() && + return getDecl()->isCompleteDefinition() && (getNameLoc().isInvalid() || getNameLoc() == getDecl()->getLocation()); } }; diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index e95d01a98fb..050a9ab2c65 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -2233,7 +2233,7 @@ Decl *ASTNodeImporter::VisitEnumDecl(EnumDecl *D) { D2->setIntegerType(ToIntegerType); // Import the definition - if (D->isDefinition() && ImportDefinition(D, D2)) + if (D->isCompleteDefinition() && ImportDefinition(D, D2)) return 0; return D2; @@ -2286,7 +2286,7 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) { if (RecordDecl *FoundRecord = dyn_cast<RecordDecl>(Found)) { if (RecordDecl *FoundDef = FoundRecord->getDefinition()) { - if (!D->isDefinition() || IsStructuralMatch(D, FoundDef)) { + if (!D->isCompleteDefinition() || IsStructuralMatch(D, FoundDef)) { // The record types structurally match, or the "from" translation // unit only had a forward declaration anyway; call it the same // function. @@ -2334,7 +2334,7 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) { Importer.Imported(D, D2); - if (D->isDefinition() && ImportDefinition(D, D2)) + if (D->isCompleteDefinition() && ImportDefinition(D, D2)) return 0; return D2; @@ -3713,7 +3713,8 @@ Decl *ASTNodeImporter::VisitClassTemplateDecl(ClassTemplateDecl *D) { Importer.Imported(D, D2); Importer.Imported(DTemplated, D2Templated); - if (DTemplated->isDefinition() && !D2Templated->isDefinition()) { + if (DTemplated->isCompleteDefinition() && + !D2Templated->isCompleteDefinition()) { // FIXME: Import definition! } @@ -3775,7 +3776,7 @@ Decl *ASTNodeImporter::VisitClassTemplateSpecializationDecl( // FIXME: Check for specialization vs. instantiation errors. if (RecordDecl *FoundDef = D2->getDefinition()) { - if (!D->isDefinition() || IsStructuralMatch(D, FoundDef)) { + if (!D->isCompleteDefinition() || IsStructuralMatch(D, FoundDef)) { // The record types structurally match, or the "from" translation // unit only had a forward declaration anyway; call it the same // function. @@ -3805,7 +3806,7 @@ Decl *ASTNodeImporter::VisitClassTemplateSpecializationDecl( } Importer.Imported(D, D2); - if (D->isDefinition() && ImportDefinition(D, D2)) + if (D->isCompleteDefinition() && ImportDefinition(D, D2)) return 0; return D2; diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 9870c8ea6bc..9e6947d5e3a 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -2271,22 +2271,22 @@ void TagDecl::completeDefinition() { cast<CXXRecordDecl>(this)->hasDefinition()) && "definition completed but not started"); - IsDefinition = true; + IsCompleteDefinition = true; IsBeingDefined = false; if (ASTMutationListener *L = getASTMutationListener()) L->CompletedTagDefinition(this); } -TagDecl* TagDecl::getDefinition() const { - if (isDefinition()) +TagDecl *TagDecl::getDefinition() const { + if (isCompleteDefinition()) return const_cast<TagDecl *>(this); if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(this)) return CXXRD->getDefinition(); for (redecl_iterator R = redecls_begin(), REnd = redecls_end(); R != REnd; ++R) - if (R->isDefinition()) + if (R->isCompleteDefinition()) return *R; return 0; @@ -2348,7 +2348,7 @@ void EnumDecl::completeDefinition(QualType NewType, QualType NewPromotionType, unsigned NumPositiveBits, unsigned NumNegativeBits) { - assert(!isDefinition() && "Cannot redefine enums!"); + assert(!isCompleteDefinition() && "Cannot redefine enums!"); if (!IntegerType) IntegerType = NewType.getTypePtr(); PromotionType = NewPromotionType; @@ -2401,7 +2401,7 @@ RecordDecl::field_iterator RecordDecl::field_begin() const { /// completeDefinition - Notes that the definition of this type is now /// complete. void RecordDecl::completeDefinition() { - assert(!isDefinition() && "Cannot redefine record!"); + assert(!isCompleteDefinition() && "Cannot redefine record!"); TagDecl::completeDefinition(); } diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index 7c61bae9ad1..73f5cdb1222 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -141,7 +141,7 @@ void Decl::printGroup(Decl** Begin, unsigned NumDecls, ++Begin; PrintingPolicy SubPolicy(Policy); - if (TD && TD->isDefinition()) { + if (TD && TD->isCompleteDefinition()) { TD->print(Out, Policy, Indentation); Out << " "; SubPolicy.SuppressTag = true; @@ -345,7 +345,7 @@ void DeclPrinter::VisitEnumDecl(EnumDecl *D) { Out << " : " << Underlying; } - if (D->isDefinition()) { + if (D->isCompleteDefinition()) { Out << " {\n"; VisitDeclContext(D); Indent() << "}"; @@ -359,7 +359,7 @@ void DeclPrinter::VisitRecordDecl(RecordDecl *D) { if (D->getIdentifier()) Out << ' ' << D; - if (D->isDefinition()) { + if (D->isCompleteDefinition()) { Out << " {\n"; VisitDeclContext(D); Indent() << "}"; @@ -670,7 +670,7 @@ void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) { if (D->getIdentifier()) Out << ' ' << D; - if (D->isDefinition()) { + if (D->isCompleteDefinition()) { // Print the base classes if (D->getNumBases()) { Out << " : "; diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index 369ebec3ddf..f351d76d76d 100644 --- a/clang/lib/AST/RecordLayoutBuilder.cpp +++ b/clang/lib/AST/RecordLayoutBuilder.cpp @@ -2013,7 +2013,7 @@ ASTContext::getASTRecordLayout(const RecordDecl *D) const { // until we *finish* parsing the definition. D = D->getDefinition(); assert(D && "Cannot get layout of forward declarations!"); - assert(D->isDefinition() && "Cannot layout type before complete!"); + assert(D->isCompleteDefinition() && "Cannot layout type before complete!"); // Look up this layout, if already laid out, return what we have. // Note that we can't save a reference to the entry because this function diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 60cb3fa33e5..0e0548db6ce 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -905,7 +905,7 @@ bool Type::isIncompleteType() const { case Record: // A tagged type (struct/union/enum/class) is incomplete if the decl is a // forward declaration, but not a full definition (C99 6.2.5p22). - return !cast<TagType>(CanonicalType)->getDecl()->isDefinition(); + return !cast<TagType>(CanonicalType)->getDecl()->isCompleteDefinition(); case ConstantArray: // An array is incomplete if its element type is incomplete // (C++ [dcl.array]p1). @@ -1747,7 +1747,7 @@ static TagDecl *getInterestingTagDecl(TagDecl *decl) { for (TagDecl::redecl_iterator I = decl->redecls_begin(), E = decl->redecls_end(); I != E; ++I) { - if (I->isDefinition() || I->isBeingDefined()) + if (I->isCompleteDefinition() || I->isBeingDefined()) return *I; } // If there's no definition (not even in progress), return what we have. diff --git a/clang/lib/AST/VTableBuilder.cpp b/clang/lib/AST/VTableBuilder.cpp index 49032b49efc..7765817759a 100644 --- a/clang/lib/AST/VTableBuilder.cpp +++ b/clang/lib/AST/VTableBuilder.cpp @@ -2200,7 +2200,7 @@ void VTableContext::ComputeMethodVTableIndices(const CXXRecordDecl *RD) { const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase(); if (PrimaryBase) { - assert(PrimaryBase->isDefinition() && + assert(PrimaryBase->isCompleteDefinition() && "Should have the definition decl of the primary base!"); // Since the record decl shares its vtable pointer with the primary base diff --git a/clang/lib/CodeGen/CGRTTI.cpp b/clang/lib/CodeGen/CGRTTI.cpp index 2ad1ed39303..dbf99fa5d76 100644 --- a/clang/lib/CodeGen/CGRTTI.cpp +++ b/clang/lib/CodeGen/CGRTTI.cpp @@ -267,7 +267,7 @@ static bool ShouldUseExternalRTTIDescriptor(CodeGenModule &CGM, QualType Ty) { /// IsIncompleteClassType - Returns whether the given record type is incomplete. static bool IsIncompleteClassType(const RecordType *RecordTy) { - return !RecordTy->getDecl()->isDefinition(); + return !RecordTy->getDecl()->isCompleteDefinition(); } /// ContainsIncompleteClassType - Returns whether the given type contains an diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp index 31aed99825a..03a15ae67ea 100644 --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -526,7 +526,7 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) { case Type::Enum: { const EnumDecl *ED = cast<EnumType>(Ty)->getDecl(); - if (ED->isDefinition() || ED->isFixed()) + if (ED->isCompleteDefinition() || ED->isFixed()) return ConvertType(ED->getIntegerType()); // Return a placeholder 'i32' type. This can be changed later when the // type is defined (see UpdateCompletedType), but is likely to be the @@ -579,7 +579,7 @@ llvm::StructType *CodeGenTypes::ConvertRecordDeclType(const RecordDecl *RD) { // If this is still a forward declaration, or the LLVM type is already // complete, there's nothing more to do. RD = RD->getDefinition(); - if (RD == 0 || !RD->isDefinition() || !Ty->isOpaque()) + if (RD == 0 || !RD->isCompleteDefinition() || !Ty->isOpaque()) return Ty; // If converting this type would cause us to infinitely loop, don't do it! diff --git a/clang/lib/Frontend/ASTConsumers.cpp b/clang/lib/Frontend/ASTConsumers.cpp index 15ab2f83c24..6f94aaa22c0 100644 --- a/clang/lib/Frontend/ASTConsumers.cpp +++ b/clang/lib/Frontend/ASTConsumers.cpp @@ -123,7 +123,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, } case Decl::Enum: { const EnumDecl* ED = cast<EnumDecl>(DC); - if (ED->isDefinition()) + if (ED->isCompleteDefinition()) Out << "[enum] "; else Out << "<enum> "; @@ -132,7 +132,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, } case Decl::Record: { const RecordDecl* RD = cast<RecordDecl>(DC); - if (RD->isDefinition()) + if (RD->isCompleteDefinition()) Out << "[struct] "; else Out << "<struct> "; @@ -141,7 +141,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, } case Decl::CXXRecord: { const CXXRecordDecl* RD = cast<CXXRecordDecl>(DC); - if (RD->isDefinition()) + if (RD->isCompleteDefinition()) Out << "[class] "; else Out << "<class> "; diff --git a/clang/lib/Rewrite/RewriteObjC.cpp b/clang/lib/Rewrite/RewriteObjC.cpp index c7a567812ef..0d83e8c975a 100644 --- a/clang/lib/Rewrite/RewriteObjC.cpp +++ b/clang/lib/Rewrite/RewriteObjC.cpp @@ -5979,7 +5979,7 @@ void RewriteObjC::HandleDeclInMainFile(Decl *D) { } } else if (VD->getType()->isRecordType()) { RecordDecl *RD = VD->getType()->getAs<RecordType>()->getDecl(); - if (RD->isDefinition()) + if (RD->isCompleteDefinition()) RewriteRecordBody(RD); } if (VD->getInit()) { @@ -6011,7 +6011,7 @@ void RewriteObjC::HandleDeclInMainFile(Decl *D) { return; } if (RecordDecl *RD = dyn_cast<RecordDecl>(D)) { - if (RD->isDefinition()) + if (RD->isCompleteDefinition()) RewriteRecordBody(RD); return; } diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp index 64c72a19d29..360a0404b8f 100644 --- a/clang/lib/Sema/SemaCXXScopeSpec.cpp +++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp @@ -237,7 +237,7 @@ bool Sema::RequireCompleteDeclContext(CXXScopeSpec &SS, // until we see a definition, so awkwardly pull out this special // case. if (const EnumType *enumType = dyn_cast_or_null<EnumType>(tagType)) { - if (!enumType->getDecl()->isDefinition()) { + if (!enumType->getDecl()->isCompleteDefinition()) { Diag(loc, diag::err_incomplete_nested_name_spec) << type << SS.getRange(); SS.SetInvalid(SS.getRange()); diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index c25429c9ab9..71a7ebcd1cf 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -2592,7 +2592,7 @@ struct IntRange { // For enum types, use the known bit width of the enumerators. if (const EnumType *ET = dyn_cast<EnumType>(T)) { EnumDecl *Enum = ET->getDecl(); - if (!Enum->isDefinition()) + if (!Enum->isCompleteDefinition()) return IntRange(C.getIntWidth(QualType(T, 0)), false); unsigned NumPositive = Enum->getNumPositiveBits(); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 3692f447b31..1a80999b242 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -2292,7 +2292,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, if (RecordDecl *Record = dyn_cast_or_null<RecordDecl>(Tag)) { ProcessDeclAttributeList(S, Record, DS.getAttributes().getList()); - if (!Record->getDeclName() && Record->isDefinition() && + if (!Record->getDeclName() && Record->isCompleteDefinition() && DS.getStorageClassSpec() != DeclSpec::SCS_typedef) { if (getLangOptions().CPlusPlus || Record->getDeclContext()->isRecord()) @@ -2313,7 +2313,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, // and // STRUCT_TYPE; <- where STRUCT_TYPE is a typedef struct. RecordDecl *Record = dyn_cast_or_null<RecordDecl>(Tag); - if ((Record && Record->getDeclName() && !Record->isDefinition()) || + if ((Record && Record->getDeclName() && !Record->isCompleteDefinition()) || (DS.getTypeSpecType() == DeclSpec::TST_typename && DS.getRepAsType().get()->isStructureType())) { Diag(DS.getSourceRange().getBegin(), diag::ext_ms_anonymous_struct) diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 93efac0651b..38c0c4aef59 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2449,7 +2449,7 @@ static void handleTransparentUnionAttr(Sema &S, Decl *D, return; } - if (!RD->isDefinition()) { + if (!RD->isCompleteDefinition()) { S.Diag(Attr.getLoc(), diag::warn_transparent_union_attribute_not_definition); return; diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 75da41dd770..d5bee1d0e36 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -669,7 +669,7 @@ static bool LookupDirect(Sema &S, LookupResult &R, const DeclContext *DC) { // name lookup. Instead, any conversion function templates visible in the // context of the use are considered. [...] const CXXRecordDecl *Record = cast<CXXRecordDecl>(DC); - if (!Record->isDefinition()) + if (!Record->isCompleteDefinition()) return Found; const UnresolvedSetImpl *Unresolved = Record->getConversionFunctions(); @@ -1353,7 +1353,7 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, // Make sure that the declaration context is complete. assert((!isa<TagDecl>(LookupCtx) || LookupCtx->isDependentContext() || - cast<TagDecl>(LookupCtx)->isDefinition() || + cast<TagDecl>(LookupCtx)->isCompleteDefinition() || Context.getTypeDeclType(cast<TagDecl>(LookupCtx))->getAs<TagType>() ->isBeingDefined()) && "Declaration context must already be complete!"); diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 995d767e2be..2b863a735a4 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1841,7 +1841,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, } if (SemaRef.getLangOptions().CPlusPlus && - OwnedTagDecl && OwnedTagDecl->isDefinition()) { + OwnedTagDecl && OwnedTagDecl->isCompleteDefinition()) { // Check the contexts where C++ forbids the declaration of a new class // or enumeration in a type-specifier-seq. switch (D.getContext()) { @@ -2094,7 +2094,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, // C++ [dcl.fct]p6: // Types shall not be defined in return or parameter types. TagDecl *Tag = cast<TagDecl>(D.getDeclSpec().getRepAsDecl()); - if (Tag->isDefinition()) + if (Tag->isCompleteDefinition()) S.Diag(Tag->getLocation(), diag::err_type_defined_in_result_type) << Context.getTypeDeclType(Tag); } diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index beaf5f65a98..3e6188be4d2 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -282,7 +282,7 @@ void ASTDeclReader::VisitTagDecl(TagDecl *TD) { VisitRedeclarable(TD); TD->IdentifierNamespace = Record[Idx++]; TD->setTagKind((TagDecl::TagKind)Record[Idx++]); - TD->setDefinition(Record[Idx++]); + TD->setCompleteDefinition(Record[Idx++]); TD->setEmbeddedInDeclarator(Record[Idx++]); TD->setFreeStanding(Record[Idx++]); TD->setRBraceLoc(ReadSourceLocation(Record, Idx)); @@ -977,7 +977,7 @@ void ASTDeclReader::VisitCXXRecordDecl(CXXRecordDecl *D) { // Load the key function to avoid deserializing every method so we can // compute it. - if (D->IsDefinition) { + if (D->IsCompleteDefinition) { if (CXXMethodDecl *Key = ReadDeclAs<CXXMethodDecl>(Record, Idx)) C.KeyFunctions[D] = Key; } diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index e648c7cd5d9..b31262d375f 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -3912,7 +3912,7 @@ void ASTWriter::MacroDefinitionRead(serialization::PreprocessedEntityID ID, } void ASTWriter::CompletedTagDefinition(const TagDecl *D) { - assert(D->isDefinition()); + assert(D->isCompleteDefinition()); assert(!WritingAST && "Already writing the AST!"); if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) { // We are interested when a PCH decl is modified. @@ -3962,7 +3962,7 @@ void ASTWriter::AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) { return; // We are interested in lazily declared implicit methods. // A decl coming from PCH was modified. - assert(RD->isDefinition()); + assert(RD->isCompleteDefinition()); UpdateRecord &Record = DeclUpdates[RD]; Record.push_back(UPD_CXX_ADDED_IMPLICIT_MEMBER); Record.push_back(reinterpret_cast<uint64_t>(D)); diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index c5e06d7bf49..9b29fa60fec 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -202,7 +202,7 @@ void ASTDeclWriter::VisitTagDecl(TagDecl *D) { VisitRedeclarable(D); Record.push_back(D->getIdentifierNamespace()); Record.push_back((unsigned)D->getTagKind()); // FIXME: stable encoding - Record.push_back(D->isDefinition()); + Record.push_back(D->isCompleteDefinition()); Record.push_back(D->isEmbeddedInDeclarator()); Record.push_back(D->isFreeStanding()); Writer.AddSourceLocation(D->getRBraceLoc(), Record); @@ -914,7 +914,7 @@ void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) { // Store the key function to avoid deserializing every method so we can // compute it. - if (D->IsDefinition) + if (D->IsCompleteDefinition) Writer.AddDeclRef(Context.getKeyFunction(D), Record); Code = serialization::DECL_CXX_RECORD; @@ -1348,7 +1348,7 @@ void ASTWriter::WriteDeclsBlockAbbrevs() { // TagDecl Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind - Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isDefinition + Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCompleteDefinition Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // EmbeddedInDeclarator Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation @@ -1394,7 +1394,7 @@ void ASTWriter::WriteDeclsBlockAbbrevs() { // TagDecl Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind - Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isDefinition + Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCompleteDefinition Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // EmbeddedInDeclarator Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation diff --git a/clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp index 1bdaa4a7fbe..e398fcb3225 100644 --- a/clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp @@ -297,7 +297,7 @@ class LLVMConventionsChecker : public Checker< public: void checkASTDecl(const CXXRecordDecl *R, AnalysisManager& mgr, BugReporter &BR) const { - if (R->isDefinition()) + if (R->isCompleteDefinition()) CheckASTMemory(R, BR); } diff --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp index e4afe432905..74c9dbe0dbd 100644 --- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -897,7 +897,7 @@ RegionOffset MemRegion::getAsOffset() const { case FieldRegionKind: { const FieldRegion *FR = cast<FieldRegion>(R); const RecordDecl *RD = FR->getDecl()->getParent(); - if (!RD->isDefinition()) + if (!RD->isCompleteDefinition()) // We cannot compute offset for incomplete type. return RegionOffset(0); // Get the field number. diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp index 6d435da993e..4b76cf1a3de 100644 --- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -1485,7 +1485,7 @@ StoreRef RegionStoreManager::BindStruct(Store store, const TypedValueRegion* R, const RecordType* RT = T->getAs<RecordType>(); RecordDecl *RD = RT->getDecl(); - if (!RD->isDefinition()) + if (!RD->isCompleteDefinition()) return StoreRef(store, *this); // Handle lazy compound values. diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 8c2776d9f81..4610ae34bae 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -1592,7 +1592,7 @@ bool CursorVisitor::VisitCXXRecordDecl(CXXRecordDecl *D) { if (VisitNestedNameSpecifierLoc(QualifierLoc)) return true; - if (D->isDefinition()) { + if (D->isCompleteDefinition()) { for (CXXRecordDecl::base_class_iterator I = D->bases_begin(), E = D->bases_end(); I != E; ++I) { if (Visit(cxcursor::MakeCursorCXXBaseSpecifier(I, TU))) |