summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2012-04-18 01:06:17 +0000
committerSean Callanan <scallanan@apple.com>2012-04-18 01:06:17 +0000
commitad880767fc0d52f07d01c8d45c715a5323ceb1c6 (patch)
treec8e2ada3a720bfff3e191d3c3826130401333465
parent3d013bccfa6a71de097ce4945007a8e294dfb2bf (diff)
downloadbcm5719-llvm-ad880767fc0d52f07d01c8d45c715a5323ceb1c6.tar.gz
bcm5719-llvm-ad880767fc0d52f07d01c8d45c715a5323ceb1c6.zip
We now record metadata for Objective-C interfaces,
Objective-C methods, and Objective-C properties. llvm-svn: 154972
-rw-r--r--lldb/include/lldb/Symbol/ClangASTContext.h14
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp10
-rw-r--r--lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp3
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp33
4 files changed, 38 insertions, 22 deletions
diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h
index bdee0a012dc..11b67c36404 100644
--- a/lldb/include/lldb/Symbol/ClangASTContext.h
+++ b/lldb/include/lldb/Symbol/ClangASTContext.h
@@ -291,7 +291,7 @@ public:
const char *name,
int kind,
lldb::LanguageType language,
- clang::CXXRecordDecl **decl = NULL);
+ uint64_t metadata = 0);
static clang::FieldDecl *
AddFieldToRecordType (clang::ASTContext *ast,
@@ -449,7 +449,8 @@ public:
CreateObjCClass (const char *name,
clang::DeclContext *decl_ctx,
bool isForwardDecl,
- bool isInternal);
+ bool isInternal,
+ uint64_t metadata = 0);
static clang::FieldDecl *
AddObjCClassIVar (clang::ASTContext *ast,
@@ -487,7 +488,8 @@ public:
clang::ObjCIvarDecl *ivar_decl,
const char *property_setter_name,
const char *property_getter_name,
- uint32_t property_attributes
+ uint32_t property_attributes,
+ uint64_t metadata = 0
);
bool
@@ -499,7 +501,8 @@ public:
clang::ObjCIvarDecl *ivar_decl,
const char *property_setter_name,
const char *property_getter_name,
- uint32_t property_attributes
+ uint32_t property_attributes,
+ uint64_t metadata = 0
)
{
return ClangASTContext::AddObjCClassProperty (getASTContext(),
@@ -509,7 +512,8 @@ public:
ivar_decl,
property_setter_name,
property_getter_name,
- property_attributes);
+ property_attributes,
+ metadata);
}
bool
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index c325cc600e4..eee1118fed8 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1737,9 +1737,11 @@ SymbolFileDWARF::ParseChildMembers
ivar_decl,
prop_setter_name,
prop_getter_name,
- prop_attributes);
+ prop_attributes,
+ MakeUserID(die->GetOffset()));
- GetClangASTContext().SetMetadata((uintptr_t)ivar_decl, MakeUserID(die->GetOffset()));
+ if (ivar_decl)
+ GetClangASTContext().SetMetadata((uintptr_t)ivar_decl, MakeUserID(die->GetOffset()));
}
}
}
@@ -5176,14 +5178,12 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
if (!clang_type_was_created)
{
clang_type_was_created = true;
- clang::CXXRecordDecl *record_decl;
clang_type = ast.CreateRecordType (decl_ctx,
accessibility,
type_name_cstr,
tag_decl_kind,
class_language,
- &record_decl);
- GetClangASTContext().SetMetadata((uintptr_t)record_decl, MakeUserID(die->GetOffset()));
+ MakeUserID(die->GetOffset()));
}
}
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index f4d9e032087..b21343dc6d8 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -407,7 +407,8 @@ SymbolFileSymtab::FindTypes (const lldb_private::SymbolContext& sc,
lldb::clang_type_t objc_object_type = ast.CreateObjCClass (name.AsCString(),
ast.GetTranslationUnitDecl(),
isForwardDecl,
- isInternal);
+ isInternal,
+ 0xffaaffaaffaaffaall);
Declaration decl;
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 0262d3d8e4b..1d7063b4ebb 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -1125,14 +1125,11 @@ ClangASTContext::GetTypeForDecl (ObjCInterfaceDecl *decl)
#pragma mark Structure, Unions, Classes
clang_type_t
-ClangASTContext::CreateRecordType (DeclContext *decl_ctx, AccessType access_type, const char *name, int kind, LanguageType language, CXXRecordDecl **out_decl)
+ClangASTContext::CreateRecordType (DeclContext *decl_ctx, AccessType access_type, const char *name, int kind, LanguageType language, uint64_t metadata)
{
ASTContext *ast = getASTContext();
assert (ast != NULL);
-
- if (out_decl)
- *out_decl = NULL;
-
+
if (decl_ctx == NULL)
decl_ctx = ast->getTranslationUnitDecl();
@@ -1141,7 +1138,7 @@ ClangASTContext::CreateRecordType (DeclContext *decl_ctx, AccessType access_type
{
bool isForwardDecl = true;
bool isInternal = false;
- return CreateObjCClass (name, decl_ctx, isForwardDecl, isInternal);
+ return CreateObjCClass (name, decl_ctx, isForwardDecl, isInternal, metadata);
}
// NOTE: Eventually CXXRecordDecl will be merged back into RecordDecl and
@@ -1156,8 +1153,8 @@ ClangASTContext::CreateRecordType (DeclContext *decl_ctx, AccessType access_type
SourceLocation(),
name && name[0] ? &ast->Idents.get(name) : NULL);
- if (out_decl)
- *out_decl = decl;
+ if (decl)
+ SetMetadata(ast, (uintptr_t)decl, metadata);
if (!name)
decl->setAnonymousStructOrUnion(true);
@@ -2251,12 +2248,13 @@ ClangASTContext::SetBaseClassesForClassType (clang_type_t class_clang_type, CXXB
#pragma mark Objective C Classes
clang_type_t
-ClangASTContext::CreateObjCClass
+ClangASTContext::CreateObjCClass
(
const char *name,
DeclContext *decl_ctx,
bool isForwardDecl,
- bool isInternal
+ bool isInternal,
+ uint64_t metadata
)
{
ASTContext *ast = getASTContext();
@@ -2279,6 +2277,9 @@ ClangASTContext::CreateObjCClass
/*isForwardDecl,*/
isInternal);
+ if (decl)
+ SetMetadata(ast, (uintptr_t)decl, metadata);
+
return ast->getObjCInterfaceType(decl).getAsOpaquePtr();
}
@@ -2390,7 +2391,8 @@ ClangASTContext::AddObjCClassProperty
ObjCIvarDecl *ivar_decl,
const char *property_setter_name,
const char *property_getter_name,
- uint32_t property_attributes
+ uint32_t property_attributes,
+ uint64_t metadata
)
{
if (class_opaque_type == NULL || property_name == NULL || property_name[0] == '\0')
@@ -2434,8 +2436,11 @@ ClangASTContext::AddObjCClassProperty
SourceLocation(), //Source location for (
prop_type_source
);
+
if (property_decl)
{
+ SetMetadata(ast, (uintptr_t)property_decl, metadata);
+
class_interface_decl->addDecl (property_decl);
Selector setter_sel, getter_sel;
@@ -2512,6 +2517,9 @@ ClangASTContext::AddObjCClassProperty
isDefined,
impControl,
HasRelatedResultType);
+
+ if (getter)
+ SetMetadata(ast, (uintptr_t)getter, metadata);
getter->setMethodParams(*ast, ArrayRef<ParmVarDecl*>(), ArrayRef<SourceLocation>());
@@ -2545,6 +2553,9 @@ ClangASTContext::AddObjCClassProperty
impControl,
HasRelatedResultType);
+ if (setter)
+ SetMetadata(ast, (uintptr_t)setter, metadata);
+
llvm::SmallVector<ParmVarDecl *, 1> params;
params.push_back (ParmVarDecl::Create (*ast,
OpenPOWER on IntegriCloud