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.
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());
}

View File

@ -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());
}
};

View File

@ -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;

View File

@ -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();
}

View File

@ -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 << " : ";

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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!

View File

@ -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> ";

View File

@ -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;
}

View File

@ -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());

View File

@ -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();

View File

@ -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)

View File

@ -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;

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
// 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!");

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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));

View File

@ -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

View File

@ -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);
}

View File

@ -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.

View File

@ -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.

View File

@ -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)))