We now record metadata for Objective-C interfaces,
Objective-C methods, and Objective-C properties. llvm-svn: 154972
This commit is contained in:
parent
3d013bccfa
commit
ad880767fc
|
@ -291,7 +291,7 @@ public:
|
||||||
const char *name,
|
const char *name,
|
||||||
int kind,
|
int kind,
|
||||||
lldb::LanguageType language,
|
lldb::LanguageType language,
|
||||||
clang::CXXRecordDecl **decl = NULL);
|
uint64_t metadata = 0);
|
||||||
|
|
||||||
static clang::FieldDecl *
|
static clang::FieldDecl *
|
||||||
AddFieldToRecordType (clang::ASTContext *ast,
|
AddFieldToRecordType (clang::ASTContext *ast,
|
||||||
|
@ -449,7 +449,8 @@ public:
|
||||||
CreateObjCClass (const char *name,
|
CreateObjCClass (const char *name,
|
||||||
clang::DeclContext *decl_ctx,
|
clang::DeclContext *decl_ctx,
|
||||||
bool isForwardDecl,
|
bool isForwardDecl,
|
||||||
bool isInternal);
|
bool isInternal,
|
||||||
|
uint64_t metadata = 0);
|
||||||
|
|
||||||
static clang::FieldDecl *
|
static clang::FieldDecl *
|
||||||
AddObjCClassIVar (clang::ASTContext *ast,
|
AddObjCClassIVar (clang::ASTContext *ast,
|
||||||
|
@ -487,7 +488,8 @@ public:
|
||||||
clang::ObjCIvarDecl *ivar_decl,
|
clang::ObjCIvarDecl *ivar_decl,
|
||||||
const char *property_setter_name,
|
const char *property_setter_name,
|
||||||
const char *property_getter_name,
|
const char *property_getter_name,
|
||||||
uint32_t property_attributes
|
uint32_t property_attributes,
|
||||||
|
uint64_t metadata = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -499,7 +501,8 @@ public:
|
||||||
clang::ObjCIvarDecl *ivar_decl,
|
clang::ObjCIvarDecl *ivar_decl,
|
||||||
const char *property_setter_name,
|
const char *property_setter_name,
|
||||||
const char *property_getter_name,
|
const char *property_getter_name,
|
||||||
uint32_t property_attributes
|
uint32_t property_attributes,
|
||||||
|
uint64_t metadata = 0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return ClangASTContext::AddObjCClassProperty (getASTContext(),
|
return ClangASTContext::AddObjCClassProperty (getASTContext(),
|
||||||
|
@ -509,7 +512,8 @@ public:
|
||||||
ivar_decl,
|
ivar_decl,
|
||||||
property_setter_name,
|
property_setter_name,
|
||||||
property_getter_name,
|
property_getter_name,
|
||||||
property_attributes);
|
property_attributes,
|
||||||
|
metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -1737,8 +1737,10 @@ SymbolFileDWARF::ParseChildMembers
|
||||||
ivar_decl,
|
ivar_decl,
|
||||||
prop_setter_name,
|
prop_setter_name,
|
||||||
prop_getter_name,
|
prop_getter_name,
|
||||||
prop_attributes);
|
prop_attributes,
|
||||||
|
MakeUserID(die->GetOffset()));
|
||||||
|
|
||||||
|
if (ivar_decl)
|
||||||
GetClangASTContext().SetMetadata((uintptr_t)ivar_decl, MakeUserID(die->GetOffset()));
|
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)
|
if (!clang_type_was_created)
|
||||||
{
|
{
|
||||||
clang_type_was_created = true;
|
clang_type_was_created = true;
|
||||||
clang::CXXRecordDecl *record_decl;
|
|
||||||
clang_type = ast.CreateRecordType (decl_ctx,
|
clang_type = ast.CreateRecordType (decl_ctx,
|
||||||
accessibility,
|
accessibility,
|
||||||
type_name_cstr,
|
type_name_cstr,
|
||||||
tag_decl_kind,
|
tag_decl_kind,
|
||||||
class_language,
|
class_language,
|
||||||
&record_decl);
|
MakeUserID(die->GetOffset()));
|
||||||
GetClangASTContext().SetMetadata((uintptr_t)record_decl, MakeUserID(die->GetOffset()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -407,7 +407,8 @@ SymbolFileSymtab::FindTypes (const lldb_private::SymbolContext& sc,
|
||||||
lldb::clang_type_t objc_object_type = ast.CreateObjCClass (name.AsCString(),
|
lldb::clang_type_t objc_object_type = ast.CreateObjCClass (name.AsCString(),
|
||||||
ast.GetTranslationUnitDecl(),
|
ast.GetTranslationUnitDecl(),
|
||||||
isForwardDecl,
|
isForwardDecl,
|
||||||
isInternal);
|
isInternal,
|
||||||
|
0xffaaffaaffaaffaall);
|
||||||
|
|
||||||
Declaration decl;
|
Declaration decl;
|
||||||
|
|
||||||
|
|
|
@ -1125,14 +1125,11 @@ ClangASTContext::GetTypeForDecl (ObjCInterfaceDecl *decl)
|
||||||
#pragma mark Structure, Unions, Classes
|
#pragma mark Structure, Unions, Classes
|
||||||
|
|
||||||
clang_type_t
|
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();
|
ASTContext *ast = getASTContext();
|
||||||
assert (ast != NULL);
|
assert (ast != NULL);
|
||||||
|
|
||||||
if (out_decl)
|
|
||||||
*out_decl = NULL;
|
|
||||||
|
|
||||||
if (decl_ctx == NULL)
|
if (decl_ctx == NULL)
|
||||||
decl_ctx = ast->getTranslationUnitDecl();
|
decl_ctx = ast->getTranslationUnitDecl();
|
||||||
|
|
||||||
|
@ -1141,7 +1138,7 @@ ClangASTContext::CreateRecordType (DeclContext *decl_ctx, AccessType access_type
|
||||||
{
|
{
|
||||||
bool isForwardDecl = true;
|
bool isForwardDecl = true;
|
||||||
bool isInternal = false;
|
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
|
// NOTE: Eventually CXXRecordDecl will be merged back into RecordDecl and
|
||||||
|
@ -1156,8 +1153,8 @@ ClangASTContext::CreateRecordType (DeclContext *decl_ctx, AccessType access_type
|
||||||
SourceLocation(),
|
SourceLocation(),
|
||||||
name && name[0] ? &ast->Idents.get(name) : NULL);
|
name && name[0] ? &ast->Idents.get(name) : NULL);
|
||||||
|
|
||||||
if (out_decl)
|
if (decl)
|
||||||
*out_decl = decl;
|
SetMetadata(ast, (uintptr_t)decl, metadata);
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
decl->setAnonymousStructOrUnion(true);
|
decl->setAnonymousStructOrUnion(true);
|
||||||
|
@ -2256,7 +2253,8 @@ ClangASTContext::CreateObjCClass
|
||||||
const char *name,
|
const char *name,
|
||||||
DeclContext *decl_ctx,
|
DeclContext *decl_ctx,
|
||||||
bool isForwardDecl,
|
bool isForwardDecl,
|
||||||
bool isInternal
|
bool isInternal,
|
||||||
|
uint64_t metadata
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASTContext *ast = getASTContext();
|
ASTContext *ast = getASTContext();
|
||||||
|
@ -2279,6 +2277,9 @@ ClangASTContext::CreateObjCClass
|
||||||
/*isForwardDecl,*/
|
/*isForwardDecl,*/
|
||||||
isInternal);
|
isInternal);
|
||||||
|
|
||||||
|
if (decl)
|
||||||
|
SetMetadata(ast, (uintptr_t)decl, metadata);
|
||||||
|
|
||||||
return ast->getObjCInterfaceType(decl).getAsOpaquePtr();
|
return ast->getObjCInterfaceType(decl).getAsOpaquePtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2390,7 +2391,8 @@ ClangASTContext::AddObjCClassProperty
|
||||||
ObjCIvarDecl *ivar_decl,
|
ObjCIvarDecl *ivar_decl,
|
||||||
const char *property_setter_name,
|
const char *property_setter_name,
|
||||||
const char *property_getter_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')
|
if (class_opaque_type == NULL || property_name == NULL || property_name[0] == '\0')
|
||||||
|
@ -2434,8 +2436,11 @@ ClangASTContext::AddObjCClassProperty
|
||||||
SourceLocation(), //Source location for (
|
SourceLocation(), //Source location for (
|
||||||
prop_type_source
|
prop_type_source
|
||||||
);
|
);
|
||||||
|
|
||||||
if (property_decl)
|
if (property_decl)
|
||||||
{
|
{
|
||||||
|
SetMetadata(ast, (uintptr_t)property_decl, metadata);
|
||||||
|
|
||||||
class_interface_decl->addDecl (property_decl);
|
class_interface_decl->addDecl (property_decl);
|
||||||
|
|
||||||
Selector setter_sel, getter_sel;
|
Selector setter_sel, getter_sel;
|
||||||
|
@ -2513,6 +2518,9 @@ ClangASTContext::AddObjCClassProperty
|
||||||
impControl,
|
impControl,
|
||||||
HasRelatedResultType);
|
HasRelatedResultType);
|
||||||
|
|
||||||
|
if (getter)
|
||||||
|
SetMetadata(ast, (uintptr_t)getter, metadata);
|
||||||
|
|
||||||
getter->setMethodParams(*ast, ArrayRef<ParmVarDecl*>(), ArrayRef<SourceLocation>());
|
getter->setMethodParams(*ast, ArrayRef<ParmVarDecl*>(), ArrayRef<SourceLocation>());
|
||||||
|
|
||||||
class_interface_decl->addDecl(getter);
|
class_interface_decl->addDecl(getter);
|
||||||
|
@ -2545,6 +2553,9 @@ ClangASTContext::AddObjCClassProperty
|
||||||
impControl,
|
impControl,
|
||||||
HasRelatedResultType);
|
HasRelatedResultType);
|
||||||
|
|
||||||
|
if (setter)
|
||||||
|
SetMetadata(ast, (uintptr_t)setter, metadata);
|
||||||
|
|
||||||
llvm::SmallVector<ParmVarDecl *, 1> params;
|
llvm::SmallVector<ParmVarDecl *, 1> params;
|
||||||
|
|
||||||
params.push_back (ParmVarDecl::Create (*ast,
|
params.push_back (ParmVarDecl::Create (*ast,
|
||||||
|
|
Loading…
Reference in New Issue