Rename TagDecl::isDefinition -> isCompleteDefinition

for better self-documenting code, since the semantics
are subtly different from getDefinition().

llvm-svn: 141355
This commit is contained in:
John McCall 2011-10-07 06:10:15 +00:00
parent bf136764ae
commit f937c023bf
25 changed files with 80 additions and 75 deletions

View File

@ -2359,9 +2359,10 @@ private:
/// TagDeclKind - The TagKind enum. /// TagDeclKind - The TagKind enum.
unsigned TagDeclKind : 2; unsigned TagDeclKind : 2;
/// IsDefinition - True if this is a definition ("struct foo {};"), false if /// IsCompleteDefinition - True if this is a definition ("struct foo
/// it is a declaration ("struct foo;"). /// {};"), false if it is a declaration ("struct foo;"). It is not
bool IsDefinition : 1; /// a definition until the definition has been fully processed.
bool IsCompleteDefinition : 1;
/// IsBeingDefined - True if this is currently being defined. /// IsBeingDefined - True if this is currently being defined.
bool IsBeingDefined : 1; bool IsBeingDefined : 1;
@ -2421,7 +2422,7 @@ protected:
assert((DK != Enum || TK == TTK_Enum) && assert((DK != Enum || TK == TTK_Enum) &&
"EnumDecl not matched with TTK_Enum"); "EnumDecl not matched with TTK_Enum");
TagDeclKind = TK; TagDeclKind = TK;
IsDefinition = false; IsCompleteDefinition = false;
IsBeingDefined = false; IsBeingDefined = false;
IsEmbeddedInDeclarator = false; IsEmbeddedInDeclarator = false;
IsFreeStanding = false; IsFreeStanding = false;
@ -2463,14 +2464,15 @@ public:
} }
/// isThisDeclarationADefinition() - Return true if this declaration /// 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 { bool isThisDeclarationADefinition() const {
return isDefinition(); return isCompleteDefinition();
} }
/// isDefinition - Return true if this decl has its body specified. /// isCompleteDefinition - Return true if this decl has its body
bool isDefinition() const { /// fully specified.
return IsDefinition; bool isCompleteDefinition() const {
return IsCompleteDefinition;
} }
/// isBeingDefined - Return true if this decl is currently being defined. /// isBeingDefined - Return true if this decl is currently being defined.
@ -2504,14 +2506,15 @@ public:
/// getDefinition - Returns the TagDecl that actually defines this /// getDefinition - Returns the TagDecl that actually defines this
/// struct/union/class/enum. When determining whether or not a /// struct/union/class/enum. When determining whether or not a
/// struct/union/class/enum is completely defined, one should use this method /// struct/union/class/enum has a definition, one should use this
/// as opposed to 'isDefinition'. 'isDefinition' indicates whether or not a /// method as opposed to 'isDefinition'. 'isDefinition' indicates
/// specific TagDecl is defining declaration, not whether or not the /// whether or not a specific TagDecl is defining declaration, not
/// struct/union/class/enum type is defined. This method returns NULL if /// whether or not the struct/union/class/enum type is defined.
/// there is no TagDecl that defines the struct/union/class/enum. /// This method returns NULL if there is no TagDecl that defines
TagDecl* getDefinition() const; /// the struct/union/class/enum.
TagDecl *getDefinition() const;
void setDefinition(bool V) { IsDefinition = V; } void setCompleteDefinition(bool V) { IsCompleteDefinition = V; }
const char *getKindName() const { const char *getKindName() const {
return TypeWithKeyword::getTagTypeKindName(getTagKind()); return TypeWithKeyword::getTagTypeKindName(getTagKind());
@ -2751,7 +2754,7 @@ public:
/// \brief Returns true if this can be considered a complete type. /// \brief Returns true if this can be considered a complete type.
bool isComplete() const { bool isComplete() const {
return isDefinition() || isFixed(); return isCompleteDefinition() || isFixed();
} }
/// \brief Returns the enumeration (declared within the template) /// \brief Returns the enumeration (declared within the template)
@ -2854,14 +2857,15 @@ public:
/// \endcode /// \endcode
bool isInjectedClassName() const; bool isInjectedClassName() const;
/// getDefinition - Returns the RecordDecl that actually defines this /// getDefinition - Returns the RecordDecl that actually defines
/// struct/union/class. When determining whether or not a struct/union/class /// this struct/union/class. When determining whether or not a
/// is completely defined, one should use this method as opposed to /// struct/union/class is completely defined, one should use this
/// 'isDefinition'. 'isDefinition' indicates whether or not a specific /// method as opposed to 'isCompleteDefinition'.
/// RecordDecl is defining declaration, not whether or not the record /// 'isCompleteDefinition' indicates whether or not a specific
/// type is defined. This method returns NULL if there is no RecordDecl /// RecordDecl is a completed definition, not whether or not the
/// that defines the struct/union/tag. /// record type is defined. This method returns NULL if there is
RecordDecl* getDefinition() const { /// no RecordDecl that defines the struct/union/tag.
RecordDecl *getDefinition() const {
return cast_or_null<RecordDecl>(TagDecl::getDefinition()); return cast_or_null<RecordDecl>(TagDecl::getDefinition());
} }

View File

@ -568,7 +568,7 @@ public:
/// \brief True if the tag was defined in this type specifier. /// \brief True if the tag was defined in this type specifier.
bool isDefinition() const { bool isDefinition() const {
return getDecl()->isDefinition() && return getDecl()->isCompleteDefinition() &&
(getNameLoc().isInvalid() || getNameLoc() == getDecl()->getLocation()); (getNameLoc().isInvalid() || getNameLoc() == getDecl()->getLocation());
} }
}; };

View File

@ -2233,7 +2233,7 @@ Decl *ASTNodeImporter::VisitEnumDecl(EnumDecl *D) {
D2->setIntegerType(ToIntegerType); D2->setIntegerType(ToIntegerType);
// Import the definition // Import the definition
if (D->isDefinition() && ImportDefinition(D, D2)) if (D->isCompleteDefinition() && ImportDefinition(D, D2))
return 0; return 0;
return D2; return D2;
@ -2286,7 +2286,7 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) {
if (RecordDecl *FoundRecord = dyn_cast<RecordDecl>(Found)) { if (RecordDecl *FoundRecord = dyn_cast<RecordDecl>(Found)) {
if (RecordDecl *FoundDef = FoundRecord->getDefinition()) { 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 // The record types structurally match, or the "from" translation
// unit only had a forward declaration anyway; call it the same // unit only had a forward declaration anyway; call it the same
// function. // function.
@ -2334,7 +2334,7 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) {
Importer.Imported(D, D2); Importer.Imported(D, D2);
if (D->isDefinition() && ImportDefinition(D, D2)) if (D->isCompleteDefinition() && ImportDefinition(D, D2))
return 0; return 0;
return D2; return D2;
@ -3713,7 +3713,8 @@ Decl *ASTNodeImporter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
Importer.Imported(D, D2); Importer.Imported(D, D2);
Importer.Imported(DTemplated, D2Templated); Importer.Imported(DTemplated, D2Templated);
if (DTemplated->isDefinition() && !D2Templated->isDefinition()) { if (DTemplated->isCompleteDefinition() &&
!D2Templated->isCompleteDefinition()) {
// FIXME: Import definition! // FIXME: Import definition!
} }
@ -3775,7 +3776,7 @@ Decl *ASTNodeImporter::VisitClassTemplateSpecializationDecl(
// FIXME: Check for specialization vs. instantiation errors. // FIXME: Check for specialization vs. instantiation errors.
if (RecordDecl *FoundDef = D2->getDefinition()) { 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 // The record types structurally match, or the "from" translation
// unit only had a forward declaration anyway; call it the same // unit only had a forward declaration anyway; call it the same
// function. // function.
@ -3805,7 +3806,7 @@ Decl *ASTNodeImporter::VisitClassTemplateSpecializationDecl(
} }
Importer.Imported(D, D2); Importer.Imported(D, D2);
if (D->isDefinition() && ImportDefinition(D, D2)) if (D->isCompleteDefinition() && ImportDefinition(D, D2))
return 0; return 0;
return D2; return D2;

View File

@ -2271,22 +2271,22 @@ void TagDecl::completeDefinition() {
cast<CXXRecordDecl>(this)->hasDefinition()) && cast<CXXRecordDecl>(this)->hasDefinition()) &&
"definition completed but not started"); "definition completed but not started");
IsDefinition = true; IsCompleteDefinition = true;
IsBeingDefined = false; IsBeingDefined = false;
if (ASTMutationListener *L = getASTMutationListener()) if (ASTMutationListener *L = getASTMutationListener())
L->CompletedTagDefinition(this); L->CompletedTagDefinition(this);
} }
TagDecl* TagDecl::getDefinition() const { TagDecl *TagDecl::getDefinition() const {
if (isDefinition()) if (isCompleteDefinition())
return const_cast<TagDecl *>(this); return const_cast<TagDecl *>(this);
if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(this)) if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(this))
return CXXRD->getDefinition(); return CXXRD->getDefinition();
for (redecl_iterator R = redecls_begin(), REnd = redecls_end(); for (redecl_iterator R = redecls_begin(), REnd = redecls_end();
R != REnd; ++R) R != REnd; ++R)
if (R->isDefinition()) if (R->isCompleteDefinition())
return *R; return *R;
return 0; return 0;
@ -2348,7 +2348,7 @@ void EnumDecl::completeDefinition(QualType NewType,
QualType NewPromotionType, QualType NewPromotionType,
unsigned NumPositiveBits, unsigned NumPositiveBits,
unsigned NumNegativeBits) { unsigned NumNegativeBits) {
assert(!isDefinition() && "Cannot redefine enums!"); assert(!isCompleteDefinition() && "Cannot redefine enums!");
if (!IntegerType) if (!IntegerType)
IntegerType = NewType.getTypePtr(); IntegerType = NewType.getTypePtr();
PromotionType = NewPromotionType; PromotionType = NewPromotionType;
@ -2401,7 +2401,7 @@ RecordDecl::field_iterator RecordDecl::field_begin() const {
/// completeDefinition - Notes that the definition of this type is now /// completeDefinition - Notes that the definition of this type is now
/// complete. /// complete.
void RecordDecl::completeDefinition() { void RecordDecl::completeDefinition() {
assert(!isDefinition() && "Cannot redefine record!"); assert(!isCompleteDefinition() && "Cannot redefine record!");
TagDecl::completeDefinition(); TagDecl::completeDefinition();
} }

View File

@ -141,7 +141,7 @@ void Decl::printGroup(Decl** Begin, unsigned NumDecls,
++Begin; ++Begin;
PrintingPolicy SubPolicy(Policy); PrintingPolicy SubPolicy(Policy);
if (TD && TD->isDefinition()) { if (TD && TD->isCompleteDefinition()) {
TD->print(Out, Policy, Indentation); TD->print(Out, Policy, Indentation);
Out << " "; Out << " ";
SubPolicy.SuppressTag = true; SubPolicy.SuppressTag = true;
@ -345,7 +345,7 @@ void DeclPrinter::VisitEnumDecl(EnumDecl *D) {
Out << " : " << Underlying; Out << " : " << Underlying;
} }
if (D->isDefinition()) { if (D->isCompleteDefinition()) {
Out << " {\n"; Out << " {\n";
VisitDeclContext(D); VisitDeclContext(D);
Indent() << "}"; Indent() << "}";
@ -359,7 +359,7 @@ void DeclPrinter::VisitRecordDecl(RecordDecl *D) {
if (D->getIdentifier()) if (D->getIdentifier())
Out << ' ' << D; Out << ' ' << D;
if (D->isDefinition()) { if (D->isCompleteDefinition()) {
Out << " {\n"; Out << " {\n";
VisitDeclContext(D); VisitDeclContext(D);
Indent() << "}"; Indent() << "}";
@ -670,7 +670,7 @@ void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) {
if (D->getIdentifier()) if (D->getIdentifier())
Out << ' ' << D; Out << ' ' << D;
if (D->isDefinition()) { if (D->isCompleteDefinition()) {
// Print the base classes // Print the base classes
if (D->getNumBases()) { if (D->getNumBases()) {
Out << " : "; Out << " : ";

View File

@ -2013,7 +2013,7 @@ ASTContext::getASTRecordLayout(const RecordDecl *D) const {
// until we *finish* parsing the definition. // until we *finish* parsing the definition.
D = D->getDefinition(); D = D->getDefinition();
assert(D && "Cannot get layout of forward declarations!"); 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. // 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 // Note that we can't save a reference to the entry because this function

View File

@ -905,7 +905,7 @@ bool Type::isIncompleteType() const {
case Record: case Record:
// A tagged type (struct/union/enum/class) is incomplete if the decl is a // 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). // 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: case ConstantArray:
// An array is incomplete if its element type is incomplete // An array is incomplete if its element type is incomplete
// (C++ [dcl.array]p1). // (C++ [dcl.array]p1).
@ -1747,7 +1747,7 @@ static TagDecl *getInterestingTagDecl(TagDecl *decl) {
for (TagDecl::redecl_iterator I = decl->redecls_begin(), for (TagDecl::redecl_iterator I = decl->redecls_begin(),
E = decl->redecls_end(); E = decl->redecls_end();
I != E; ++I) { I != E; ++I) {
if (I->isDefinition() || I->isBeingDefined()) if (I->isCompleteDefinition() || I->isBeingDefined())
return *I; return *I;
} }
// If there's no definition (not even in progress), return what we have. // If there's no definition (not even in progress), return what we have.

View File

@ -2200,7 +2200,7 @@ void VTableContext::ComputeMethodVTableIndices(const CXXRecordDecl *RD) {
const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase(); const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase();
if (PrimaryBase) { if (PrimaryBase) {
assert(PrimaryBase->isDefinition() && assert(PrimaryBase->isCompleteDefinition() &&
"Should have the definition decl of the primary base!"); "Should have the definition decl of the primary base!");
// Since the record decl shares its vtable pointer with the primary base // Since the record decl shares its vtable pointer with the primary base

View File

@ -267,7 +267,7 @@ static bool ShouldUseExternalRTTIDescriptor(CodeGenModule &CGM, QualType Ty) {
/// IsIncompleteClassType - Returns whether the given record type is incomplete. /// IsIncompleteClassType - Returns whether the given record type is incomplete.
static bool IsIncompleteClassType(const RecordType *RecordTy) { static bool IsIncompleteClassType(const RecordType *RecordTy) {
return !RecordTy->getDecl()->isDefinition(); return !RecordTy->getDecl()->isCompleteDefinition();
} }
/// ContainsIncompleteClassType - Returns whether the given type contains an /// ContainsIncompleteClassType - Returns whether the given type contains an

View File

@ -526,7 +526,7 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
case Type::Enum: { case Type::Enum: {
const EnumDecl *ED = cast<EnumType>(Ty)->getDecl(); const EnumDecl *ED = cast<EnumType>(Ty)->getDecl();
if (ED->isDefinition() || ED->isFixed()) if (ED->isCompleteDefinition() || ED->isFixed())
return ConvertType(ED->getIntegerType()); return ConvertType(ED->getIntegerType());
// Return a placeholder 'i32' type. This can be changed later when the // Return a placeholder 'i32' type. This can be changed later when the
// type is defined (see UpdateCompletedType), but is likely to be 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 // If this is still a forward declaration, or the LLVM type is already
// complete, there's nothing more to do. // complete, there's nothing more to do.
RD = RD->getDefinition(); RD = RD->getDefinition();
if (RD == 0 || !RD->isDefinition() || !Ty->isOpaque()) if (RD == 0 || !RD->isCompleteDefinition() || !Ty->isOpaque())
return Ty; return Ty;
// If converting this type would cause us to infinitely loop, don't do it! // If converting this type would cause us to infinitely loop, don't do it!

View File

@ -123,7 +123,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC,
} }
case Decl::Enum: { case Decl::Enum: {
const EnumDecl* ED = cast<EnumDecl>(DC); const EnumDecl* ED = cast<EnumDecl>(DC);
if (ED->isDefinition()) if (ED->isCompleteDefinition())
Out << "[enum] "; Out << "[enum] ";
else else
Out << "<enum> "; Out << "<enum> ";
@ -132,7 +132,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC,
} }
case Decl::Record: { case Decl::Record: {
const RecordDecl* RD = cast<RecordDecl>(DC); const RecordDecl* RD = cast<RecordDecl>(DC);
if (RD->isDefinition()) if (RD->isCompleteDefinition())
Out << "[struct] "; Out << "[struct] ";
else else
Out << "<struct> "; Out << "<struct> ";
@ -141,7 +141,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC,
} }
case Decl::CXXRecord: { case Decl::CXXRecord: {
const CXXRecordDecl* RD = cast<CXXRecordDecl>(DC); const CXXRecordDecl* RD = cast<CXXRecordDecl>(DC);
if (RD->isDefinition()) if (RD->isCompleteDefinition())
Out << "[class] "; Out << "[class] ";
else else
Out << "<class> "; Out << "<class> ";

View File

@ -5979,7 +5979,7 @@ void RewriteObjC::HandleDeclInMainFile(Decl *D) {
} }
} else if (VD->getType()->isRecordType()) { } else if (VD->getType()->isRecordType()) {
RecordDecl *RD = VD->getType()->getAs<RecordType>()->getDecl(); RecordDecl *RD = VD->getType()->getAs<RecordType>()->getDecl();
if (RD->isDefinition()) if (RD->isCompleteDefinition())
RewriteRecordBody(RD); RewriteRecordBody(RD);
} }
if (VD->getInit()) { if (VD->getInit()) {
@ -6011,7 +6011,7 @@ void RewriteObjC::HandleDeclInMainFile(Decl *D) {
return; return;
} }
if (RecordDecl *RD = dyn_cast<RecordDecl>(D)) { if (RecordDecl *RD = dyn_cast<RecordDecl>(D)) {
if (RD->isDefinition()) if (RD->isCompleteDefinition())
RewriteRecordBody(RD); RewriteRecordBody(RD);
return; return;
} }

View File

@ -237,7 +237,7 @@ bool Sema::RequireCompleteDeclContext(CXXScopeSpec &SS,
// until we see a definition, so awkwardly pull out this special // until we see a definition, so awkwardly pull out this special
// case. // case.
if (const EnumType *enumType = dyn_cast_or_null<EnumType>(tagType)) { 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) Diag(loc, diag::err_incomplete_nested_name_spec)
<< type << SS.getRange(); << type << SS.getRange();
SS.SetInvalid(SS.getRange()); SS.SetInvalid(SS.getRange());

View File

@ -2592,7 +2592,7 @@ struct IntRange {
// For enum types, use the known bit width of the enumerators. // For enum types, use the known bit width of the enumerators.
if (const EnumType *ET = dyn_cast<EnumType>(T)) { if (const EnumType *ET = dyn_cast<EnumType>(T)) {
EnumDecl *Enum = ET->getDecl(); EnumDecl *Enum = ET->getDecl();
if (!Enum->isDefinition()) if (!Enum->isCompleteDefinition())
return IntRange(C.getIntWidth(QualType(T, 0)), false); return IntRange(C.getIntWidth(QualType(T, 0)), false);
unsigned NumPositive = Enum->getNumPositiveBits(); unsigned NumPositive = Enum->getNumPositiveBits();

View File

@ -2292,7 +2292,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
if (RecordDecl *Record = dyn_cast_or_null<RecordDecl>(Tag)) { if (RecordDecl *Record = dyn_cast_or_null<RecordDecl>(Tag)) {
ProcessDeclAttributeList(S, Record, DS.getAttributes().getList()); ProcessDeclAttributeList(S, Record, DS.getAttributes().getList());
if (!Record->getDeclName() && Record->isDefinition() && if (!Record->getDeclName() && Record->isCompleteDefinition() &&
DS.getStorageClassSpec() != DeclSpec::SCS_typedef) { DS.getStorageClassSpec() != DeclSpec::SCS_typedef) {
if (getLangOptions().CPlusPlus || if (getLangOptions().CPlusPlus ||
Record->getDeclContext()->isRecord()) Record->getDeclContext()->isRecord())
@ -2313,7 +2313,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
// and // and
// STRUCT_TYPE; <- where STRUCT_TYPE is a typedef struct. // STRUCT_TYPE; <- where STRUCT_TYPE is a typedef struct.
RecordDecl *Record = dyn_cast_or_null<RecordDecl>(Tag); 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.getTypeSpecType() == DeclSpec::TST_typename &&
DS.getRepAsType().get()->isStructureType())) { DS.getRepAsType().get()->isStructureType())) {
Diag(DS.getSourceRange().getBegin(), diag::ext_ms_anonymous_struct) Diag(DS.getSourceRange().getBegin(), diag::ext_ms_anonymous_struct)

View File

@ -2449,7 +2449,7 @@ static void handleTransparentUnionAttr(Sema &S, Decl *D,
return; return;
} }
if (!RD->isDefinition()) { if (!RD->isCompleteDefinition()) {
S.Diag(Attr.getLoc(), S.Diag(Attr.getLoc(),
diag::warn_transparent_union_attribute_not_definition); diag::warn_transparent_union_attribute_not_definition);
return; return;

View File

@ -669,7 +669,7 @@ static bool LookupDirect(Sema &S, LookupResult &R, const DeclContext *DC) {
// name lookup. Instead, any conversion function templates visible in the // name lookup. Instead, any conversion function templates visible in the
// context of the use are considered. [...] // context of the use are considered. [...]
const CXXRecordDecl *Record = cast<CXXRecordDecl>(DC); const CXXRecordDecl *Record = cast<CXXRecordDecl>(DC);
if (!Record->isDefinition()) if (!Record->isCompleteDefinition())
return Found; return Found;
const UnresolvedSetImpl *Unresolved = Record->getConversionFunctions(); const UnresolvedSetImpl *Unresolved = Record->getConversionFunctions();
@ -1353,7 +1353,7 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
// Make sure that the declaration context is complete. // Make sure that the declaration context is complete.
assert((!isa<TagDecl>(LookupCtx) || assert((!isa<TagDecl>(LookupCtx) ||
LookupCtx->isDependentContext() || LookupCtx->isDependentContext() ||
cast<TagDecl>(LookupCtx)->isDefinition() || cast<TagDecl>(LookupCtx)->isCompleteDefinition() ||
Context.getTypeDeclType(cast<TagDecl>(LookupCtx))->getAs<TagType>() Context.getTypeDeclType(cast<TagDecl>(LookupCtx))->getAs<TagType>()
->isBeingDefined()) && ->isBeingDefined()) &&
"Declaration context must already be complete!"); "Declaration context must already be complete!");

View File

@ -1841,7 +1841,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state,
} }
if (SemaRef.getLangOptions().CPlusPlus && if (SemaRef.getLangOptions().CPlusPlus &&
OwnedTagDecl && OwnedTagDecl->isDefinition()) { OwnedTagDecl && OwnedTagDecl->isCompleteDefinition()) {
// Check the contexts where C++ forbids the declaration of a new class // Check the contexts where C++ forbids the declaration of a new class
// or enumeration in a type-specifier-seq. // or enumeration in a type-specifier-seq.
switch (D.getContext()) { switch (D.getContext()) {
@ -2094,7 +2094,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
// C++ [dcl.fct]p6: // C++ [dcl.fct]p6:
// Types shall not be defined in return or parameter types. // Types shall not be defined in return or parameter types.
TagDecl *Tag = cast<TagDecl>(D.getDeclSpec().getRepAsDecl()); TagDecl *Tag = cast<TagDecl>(D.getDeclSpec().getRepAsDecl());
if (Tag->isDefinition()) if (Tag->isCompleteDefinition())
S.Diag(Tag->getLocation(), diag::err_type_defined_in_result_type) S.Diag(Tag->getLocation(), diag::err_type_defined_in_result_type)
<< Context.getTypeDeclType(Tag); << Context.getTypeDeclType(Tag);
} }

View File

@ -282,7 +282,7 @@ void ASTDeclReader::VisitTagDecl(TagDecl *TD) {
VisitRedeclarable(TD); VisitRedeclarable(TD);
TD->IdentifierNamespace = Record[Idx++]; TD->IdentifierNamespace = Record[Idx++];
TD->setTagKind((TagDecl::TagKind)Record[Idx++]); TD->setTagKind((TagDecl::TagKind)Record[Idx++]);
TD->setDefinition(Record[Idx++]); TD->setCompleteDefinition(Record[Idx++]);
TD->setEmbeddedInDeclarator(Record[Idx++]); TD->setEmbeddedInDeclarator(Record[Idx++]);
TD->setFreeStanding(Record[Idx++]); TD->setFreeStanding(Record[Idx++]);
TD->setRBraceLoc(ReadSourceLocation(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 // Load the key function to avoid deserializing every method so we can
// compute it. // compute it.
if (D->IsDefinition) { if (D->IsCompleteDefinition) {
if (CXXMethodDecl *Key = ReadDeclAs<CXXMethodDecl>(Record, Idx)) if (CXXMethodDecl *Key = ReadDeclAs<CXXMethodDecl>(Record, Idx))
C.KeyFunctions[D] = Key; C.KeyFunctions[D] = Key;
} }

View File

@ -3912,7 +3912,7 @@ void ASTWriter::MacroDefinitionRead(serialization::PreprocessedEntityID ID,
} }
void ASTWriter::CompletedTagDefinition(const TagDecl *D) { void ASTWriter::CompletedTagDefinition(const TagDecl *D) {
assert(D->isDefinition()); assert(D->isCompleteDefinition());
assert(!WritingAST && "Already writing the AST!"); assert(!WritingAST && "Already writing the AST!");
if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) { if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) {
// We are interested when a PCH decl is modified. // 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. return; // We are interested in lazily declared implicit methods.
// A decl coming from PCH was modified. // A decl coming from PCH was modified.
assert(RD->isDefinition()); assert(RD->isCompleteDefinition());
UpdateRecord &Record = DeclUpdates[RD]; UpdateRecord &Record = DeclUpdates[RD];
Record.push_back(UPD_CXX_ADDED_IMPLICIT_MEMBER); Record.push_back(UPD_CXX_ADDED_IMPLICIT_MEMBER);
Record.push_back(reinterpret_cast<uint64_t>(D)); Record.push_back(reinterpret_cast<uint64_t>(D));

View File

@ -202,7 +202,7 @@ void ASTDeclWriter::VisitTagDecl(TagDecl *D) {
VisitRedeclarable(D); VisitRedeclarable(D);
Record.push_back(D->getIdentifierNamespace()); Record.push_back(D->getIdentifierNamespace());
Record.push_back((unsigned)D->getTagKind()); // FIXME: stable encoding 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->isEmbeddedInDeclarator());
Record.push_back(D->isFreeStanding()); Record.push_back(D->isFreeStanding());
Writer.AddSourceLocation(D->getRBraceLoc(), Record); 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 // Store the key function to avoid deserializing every method so we can
// compute it. // compute it.
if (D->IsDefinition) if (D->IsCompleteDefinition)
Writer.AddDeclRef(Context.getKeyFunction(D), Record); Writer.AddDeclRef(Context.getKeyFunction(D), Record);
Code = serialization::DECL_CXX_RECORD; Code = serialization::DECL_CXX_RECORD;
@ -1348,7 +1348,7 @@ void ASTWriter::WriteDeclsBlockAbbrevs() {
// TagDecl // TagDecl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind 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)); // EmbeddedInDeclarator
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
@ -1394,7 +1394,7 @@ void ASTWriter::WriteDeclsBlockAbbrevs() {
// TagDecl // TagDecl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind 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)); // EmbeddedInDeclarator
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation

View File

@ -297,7 +297,7 @@ class LLVMConventionsChecker : public Checker<
public: public:
void checkASTDecl(const CXXRecordDecl *R, AnalysisManager& mgr, void checkASTDecl(const CXXRecordDecl *R, AnalysisManager& mgr,
BugReporter &BR) const { BugReporter &BR) const {
if (R->isDefinition()) if (R->isCompleteDefinition())
CheckASTMemory(R, BR); CheckASTMemory(R, BR);
} }

View File

@ -897,7 +897,7 @@ RegionOffset MemRegion::getAsOffset() const {
case FieldRegionKind: { case FieldRegionKind: {
const FieldRegion *FR = cast<FieldRegion>(R); const FieldRegion *FR = cast<FieldRegion>(R);
const RecordDecl *RD = FR->getDecl()->getParent(); const RecordDecl *RD = FR->getDecl()->getParent();
if (!RD->isDefinition()) if (!RD->isCompleteDefinition())
// We cannot compute offset for incomplete type. // We cannot compute offset for incomplete type.
return RegionOffset(0); return RegionOffset(0);
// Get the field number. // Get the field number.

View File

@ -1485,7 +1485,7 @@ StoreRef RegionStoreManager::BindStruct(Store store, const TypedValueRegion* R,
const RecordType* RT = T->getAs<RecordType>(); const RecordType* RT = T->getAs<RecordType>();
RecordDecl *RD = RT->getDecl(); RecordDecl *RD = RT->getDecl();
if (!RD->isDefinition()) if (!RD->isCompleteDefinition())
return StoreRef(store, *this); return StoreRef(store, *this);
// Handle lazy compound values. // Handle lazy compound values.

View File

@ -1592,7 +1592,7 @@ bool CursorVisitor::VisitCXXRecordDecl(CXXRecordDecl *D) {
if (VisitNestedNameSpecifierLoc(QualifierLoc)) if (VisitNestedNameSpecifierLoc(QualifierLoc))
return true; return true;
if (D->isDefinition()) { if (D->isCompleteDefinition()) {
for (CXXRecordDecl::base_class_iterator I = D->bases_begin(), for (CXXRecordDecl::base_class_iterator I = D->bases_begin(),
E = D->bases_end(); I != E; ++I) { E = D->bases_end(); I != E; ++I) {
if (Visit(cxcursor::MakeCursorCXXBaseSpecifier(I, TU))) if (Visit(cxcursor::MakeCursorCXXBaseSpecifier(I, TU)))