This is the first phase of supporting the DW_AT_object_pointer tag. I expanded the decl metadata
so it could hold this information, and then used it to look up unfound names in the object pointer
if it exists. This gets "frame var" to work for unqualified references to ivars captured in blocks.
But the expression parser is ignoring this information still.
llvm-svn: 166860
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 4ce9aa4..76ec6bc 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -1126,7 +1126,7 @@
#pragma mark Structure, Unions, Classes
clang_type_t
-ClangASTContext::CreateRecordType (DeclContext *decl_ctx, AccessType access_type, const char *name, int kind, LanguageType language, uint64_t metadata)
+ClangASTContext::CreateRecordType (DeclContext *decl_ctx, AccessType access_type, const char *name, int kind, LanguageType language, ClangASTMetadata *metadata)
{
ASTContext *ast = getASTContext();
assert (ast != NULL);
@@ -1154,8 +1154,8 @@
SourceLocation(),
name && name[0] ? &ast->Idents.get(name) : NULL);
- if (decl)
- SetMetadata(ast, (uintptr_t)decl, metadata);
+ if (decl && metadata)
+ SetMetadata(ast, (uintptr_t)decl, *metadata);
if (decl_ctx)
{
@@ -2262,7 +2262,7 @@
DeclContext *decl_ctx,
bool isForwardDecl,
bool isInternal,
- uint64_t metadata
+ ClangASTMetadata *metadata
)
{
ASTContext *ast = getASTContext();
@@ -2285,8 +2285,8 @@
/*isForwardDecl,*/
isInternal);
- if (decl)
- SetMetadata(ast, (uintptr_t)decl, metadata);
+ if (decl && metadata)
+ SetMetadata(ast, (uintptr_t)decl, *metadata);
return ast->getObjCInterfaceType(decl).getAsOpaquePtr();
}
@@ -2400,7 +2400,7 @@
const char *property_setter_name,
const char *property_getter_name,
uint32_t property_attributes,
- uint64_t metadata
+ ClangASTMetadata *metadata
)
{
if (class_opaque_type == NULL || property_name == NULL || property_name[0] == '\0')
@@ -2447,7 +2447,8 @@
if (property_decl)
{
- SetMetadata(ast, (uintptr_t)property_decl, metadata);
+ if (metadata)
+ SetMetadata(ast, (uintptr_t)property_decl, *metadata);
class_interface_decl->addDecl (property_decl);
@@ -2526,8 +2527,8 @@
impControl,
HasRelatedResultType);
- if (getter)
- SetMetadata(ast, (uintptr_t)getter, metadata);
+ if (getter && metadata)
+ SetMetadata(ast, (uintptr_t)getter, *metadata);
getter->setMethodParams(*ast, ArrayRef<ParmVarDecl*>(), ArrayRef<SourceLocation>());
@@ -2561,8 +2562,8 @@
impControl,
HasRelatedResultType);
- if (setter)
- SetMetadata(ast, (uintptr_t)setter, metadata);
+ if (setter && metadata)
+ SetMetadata(ast, (uintptr_t)setter, *metadata);
llvm::SmallVector<ParmVarDecl *, 1> params;
@@ -6400,9 +6401,18 @@
}
void
+ClangASTContext::SetMetadataAsUserID (uintptr_t object,
+ user_id_t user_id)
+{
+ ClangASTMetadata meta_data;
+ meta_data.SetUserID (user_id);
+ SetMetadata (object, meta_data);
+}
+
+void
ClangASTContext::SetMetadata (clang::ASTContext *ast,
uintptr_t object,
- uint64_t metadata)
+ ClangASTMetadata &metadata)
{
ClangExternalASTSourceCommon *external_source =
static_cast<ClangExternalASTSourceCommon*>(ast->getExternalSource());
@@ -6411,7 +6421,7 @@
external_source->SetMetadata(object, metadata);
}
-uint64_t
+ClangASTMetadata *
ClangASTContext::GetMetadata (clang::ASTContext *ast,
uintptr_t object)
{
@@ -6421,7 +6431,7 @@
if (external_source && external_source->HasMetadata(object))
return external_source->GetMetadata(object);
else
- return 0;
+ return NULL;
}
clang::DeclContext *
@@ -6478,6 +6488,17 @@
language = eLanguageTypeObjC;
return true;
}
+ else if (clang::FunctionDecl *function_decl = llvm::dyn_cast<clang::FunctionDecl>(decl_ctx))
+ {
+ ClangASTMetadata *metadata = GetMetadata (&decl_ctx->getParentASTContext(), (uintptr_t) function_decl);
+ if (metadata && metadata->HasObjectPtr())
+ {
+ language_object_name.SetCString (metadata->GetObjectPtrName());
+ language = eLanguageTypeObjC;
+ is_instance_method = true;
+ }
+ return true;
+ }
}
return false;
}