forked from OSchip/llvm-project
Modified the way we report fields of records.
Clang requires them to have complete types, but we were previously only completing them if they were of tag or Objective-C object types. I have implemented a method on the ASTImporter whose job is to complete a type. It handles not only the cases mentioned above, but also array and atomic types. <rdar://problem/13446777> llvm-svn: 177672
This commit is contained in:
parent
23c7d67de2
commit
6b200d0b3e
|
|
@ -128,6 +128,9 @@ public:
|
|||
bool
|
||||
CompleteObjCInterfaceDecl (clang::ObjCInterfaceDecl *interface_decl);
|
||||
|
||||
bool
|
||||
RequireCompleteType (clang::QualType type);
|
||||
|
||||
bool
|
||||
ResolveDeclOrigin (const clang::Decl *decl, clang::Decl **original_decl, clang::ASTContext **original_ctx)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -468,11 +468,7 @@ ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context,
|
|||
{
|
||||
QualType copied_field_type = copied_field->getType();
|
||||
|
||||
if (const TagType *copied_field_tag_type = copied_field_type->getAs<TagType>())
|
||||
m_ast_importer->CompleteTagDecl(copied_field_tag_type->getDecl());
|
||||
if (const ObjCObjectType *copied_field_object_type = copied_field_type->getAs<ObjCObjectType>())
|
||||
if (ObjCInterfaceDecl *copied_field_objc_interface_decl = copied_field_object_type->getInterface())
|
||||
m_ast_importer->CompleteObjCInterfaceDecl(copied_field_objc_interface_decl);
|
||||
m_ast_importer->RequireCompleteType(copied_field_type);
|
||||
}
|
||||
|
||||
decls.push_back(copied_decl);
|
||||
|
|
|
|||
|
|
@ -302,6 +302,35 @@ ClangASTImporter::CompleteObjCInterfaceDecl (clang::ObjCInterfaceDecl *interface
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ClangASTImporter::RequireCompleteType (clang::QualType type)
|
||||
{
|
||||
if (type.isNull())
|
||||
return false;
|
||||
|
||||
if (const TagType *tag_type = type->getAs<TagType>())
|
||||
{
|
||||
return CompleteTagDecl(tag_type->getDecl());
|
||||
}
|
||||
if (const ObjCObjectType *objc_object_type = type->getAs<ObjCObjectType>())
|
||||
{
|
||||
if (ObjCInterfaceDecl *objc_interface_decl = objc_object_type->getInterface())
|
||||
return CompleteObjCInterfaceDecl(objc_interface_decl);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
if (const ArrayType *array_type = type->getAsArrayTypeUnsafe())
|
||||
{
|
||||
return RequireCompleteType(array_type->getElementType());
|
||||
}
|
||||
if (const AtomicType *atomic_type = type->getAs<AtomicType>())
|
||||
{
|
||||
return RequireCompleteType(atomic_type->getPointeeType());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ClangASTMetadata *
|
||||
ClangASTImporter::GetDeclMetadata (const clang::Decl *decl)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue