[Lldb-commits] [lldb] r177672 - Modified the way we report fields of records.
Sean Callanan
scallanan at apple.com
Thu Mar 21 15:15:42 PDT 2013
Author: spyffe
Date: Thu Mar 21 17:15:41 2013
New Revision: 177672
URL: http://llvm.org/viewvc/llvm-project?rev=177672&view=rev
Log:
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>
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
lldb/trunk/source/Expression/ClangASTSource.cpp
lldb/trunk/source/Symbol/ClangASTImporter.cpp
Modified: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTImporter.h?rev=177672&r1=177671&r2=177672&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTImporter.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTImporter.h Thu Mar 21 17:15:41 2013
@@ -129,6 +129,9 @@ public:
CompleteObjCInterfaceDecl (clang::ObjCInterfaceDecl *interface_decl);
bool
+ RequireCompleteType (clang::QualType type);
+
+ bool
ResolveDeclOrigin (const clang::Decl *decl, clang::Decl **original_decl, clang::ASTContext **original_ctx)
{
DeclOrigin origin = GetDeclOrigin(decl);
Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=177672&r1=177671&r2=177672&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Thu Mar 21 17:15:41 2013
@@ -468,11 +468,7 @@ ClangASTSource::FindExternalLexicalDecls
{
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);
Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=177672&r1=177671&r2=177672&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Thu Mar 21 17:15:41 2013
@@ -302,6 +302,35 @@ ClangASTImporter::CompleteObjCInterfaceD
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)
{
More information about the lldb-commits
mailing list