[Lldb-commits] [lldb] r166860 - in /lldb/trunk: include/lldb/ include/lldb/Expression/ include/lldb/Symbol/ source/Expression/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Plugins/SymbolFile/DWARF/ source/Plugins/SymbolFile/Symtab/ source/Symbol/
Jim Ingham
jingham at apple.com
Fri Oct 26 19:54:13 PDT 2012
Author: jingham
Date: Fri Oct 26 21:54:13 2012
New Revision: 166860
URL: http://llvm.org/viewvc/llvm-project?rev=166860&view=rev
Log:
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.
Modified:
lldb/trunk/include/lldb/Expression/ClangASTSource.h
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCommon.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/ClangASTImporter.cpp
lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp
Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=166860&r1=166859&r2=166860&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Fri Oct 26 21:54:13 2012
@@ -296,12 +296,13 @@
return m_original.StartTranslationUnit(Consumer);
}
- uint64_t GetMetadata(uintptr_t object)
+ ClangASTMetadata *
+ GetMetadata(uintptr_t object)
{
return m_original.GetMetadata(object);
}
- void SetMetadata(uintptr_t object, uint64_t metadata)
+ void SetMetadata(uintptr_t object, ClangASTMetadata &metadata)
{
return m_original.SetMetadata(object, metadata);
}
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=166860&r1=166859&r2=166860&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Fri Oct 26 21:54:13 2012
@@ -144,23 +144,27 @@
GetCompleteDecl (clang::ASTContext *ast,
clang::Decl *decl);
+ void SetMetadataAsUserID (uintptr_t object,
+ lldb::user_id_t user_id);
+
void SetMetadata (uintptr_t object,
- uint64_t metadata)
+ ClangASTMetadata &meta_data)
{
- SetMetadata(getASTContext(), object, metadata);
+ SetMetadata(getASTContext(), object, meta_data);
}
static void
SetMetadata (clang::ASTContext *ast,
uintptr_t object,
- uint64_t metadata);
+ ClangASTMetadata &meta_data);
- uint64_t GetMetadata (uintptr_t object)
+ ClangASTMetadata *
+ GetMetadata (uintptr_t object)
{
return GetMetadata(getASTContext(), object);
}
- static uint64_t
+ static ClangASTMetadata *
GetMetadata (clang::ASTContext *ast,
uintptr_t object);
@@ -300,7 +304,7 @@
const char *name,
int kind,
lldb::LanguageType language,
- uint64_t metadata = 0);
+ ClangASTMetadata *metadata = NULL);
static clang::FieldDecl *
AddFieldToRecordType (clang::ASTContext *ast,
@@ -459,7 +463,7 @@
clang::DeclContext *decl_ctx,
bool isForwardDecl,
bool isInternal,
- uint64_t metadata = 0);
+ ClangASTMetadata *metadata = NULL);
static clang::FieldDecl *
AddObjCClassIVar (clang::ASTContext *ast,
@@ -498,7 +502,7 @@
const char *property_setter_name,
const char *property_getter_name,
uint32_t property_attributes,
- uint64_t metadata = 0
+ ClangASTMetadata *metadata = NULL
);
bool
@@ -511,7 +515,7 @@
const char *property_setter_name,
const char *property_getter_name,
uint32_t property_attributes,
- uint64_t metadata = 0
+ ClangASTMetadata *metadata = NULL
)
{
return ClangASTContext::AddObjCClassProperty (getASTContext(),
Modified: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTImporter.h?rev=166860&r1=166859&r2=166860&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTImporter.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTImporter.h Fri Oct 26 21:54:13 2012
@@ -83,7 +83,7 @@
void
SetDeclOrigin (const clang::Decl *decl, clang::Decl *original_decl);
- uint64_t
+ ClangASTMetadata *
GetDeclMetadata (const clang::Decl *decl);
//
Modified: lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCommon.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCommon.h?rev=166860&r1=166859&r2=166860&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCommon.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCommon.h Fri Oct 26 21:54:13 2012
@@ -36,19 +36,107 @@
#include <assert.h>
#endif
+#include "lldb/lldb-defines.h"
+#include "lldb/Core/dwarf.h"
+
namespace lldb_private {
+class ClangASTMetadata
+{
+public:
+ ClangASTMetadata () :
+ m_user_id(0),
+ m_union_is_user_id(false),
+ m_union_is_isa_ptr(false),
+ m_has_object_ptr(false),
+ m_is_self (false)
+ {
+ }
+
+ void
+ SetUserID (lldb::user_id_t user_id)
+ {
+ m_user_id = user_id;
+ m_union_is_user_id = true;
+ m_union_is_isa_ptr = false;
+ }
+ lldb::user_id_t GetUserID () const
+ {
+ if (m_union_is_user_id)
+ return m_user_id;
+ else
+ return LLDB_INVALID_UID;
+ }
+
+ void
+ SetISAPtr (uint64_t isa_ptr)
+ {
+ m_isa_ptr = isa_ptr;
+ m_union_is_user_id = false;
+ m_union_is_isa_ptr = true;
+ }
+
+ uint64_t GetISAPtr () const
+ {
+ if (m_union_is_isa_ptr)
+ return m_isa_ptr;
+ else
+ return 0;
+ }
+
+ void SetObjectPtrName(const char *name)
+ {
+ m_has_object_ptr = true;
+ if (strcmp (name, "self") == 0)
+ m_is_self = true;
+ else if (strcmp (name, "this") == 0)
+ m_is_self = false;
+ else
+ m_has_object_ptr = false;
+ }
+
+ const char *GetObjectPtrName() const
+ {
+ if (m_has_object_ptr)
+ {
+ if (m_is_self)
+ return "self";
+ else
+ return "this";
+ }
+ else
+ return NULL;
+ }
+
+ bool HasObjectPtr() const
+ {
+ return m_has_object_ptr;
+ }
+
+private:
+ union
+ {
+ lldb::user_id_t m_user_id;
+ uint64_t m_isa_ptr;
+ };
+ bool m_union_is_user_id : 1,
+ m_union_is_isa_ptr : 1,
+ m_has_object_ptr : 1,
+ m_is_self : 1;
+
+};
+
class ClangExternalASTSourceCommon : public clang::ExternalASTSource
{
public:
ClangExternalASTSourceCommon();
~ClangExternalASTSourceCommon();
-
- virtual uint64_t GetMetadata(uintptr_t object);
- virtual void SetMetadata(uintptr_t object, uint64_t metadata);
+
+ virtual ClangASTMetadata *GetMetadata(uintptr_t object);
+ virtual void SetMetadata(uintptr_t object, ClangASTMetadata &metadata);
virtual bool HasMetadata(uintptr_t object);
private:
- typedef llvm::DenseMap<uintptr_t, uint64_t> MetadataMap;
+ typedef llvm::DenseMap<uintptr_t, ClangASTMetadata> MetadataMap;
MetadataMap m_metadata;
uint64_t m_magic; ///< Because we don't have RTTI, we must take it
Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=166860&r1=166859&r2=166860&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Fri Oct 26 21:54:13 2012
@@ -62,6 +62,7 @@
class CPPLanguageRuntime;
class ClangASTContext;
class ClangASTImporter;
+class ClangASTMetadata;
class ClangASTSource;
class ClangASTType;
class ClangNamespaceDecl;
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=166860&r1=166859&r2=166860&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Oct 26 21:54:13 2012
@@ -2661,7 +2661,8 @@
{
valobj = frame->GetValueForVariableExpressionPath(name_unique_cstr,
eNoDynamicValues,
- StackFrame::eExpressionPathOptionCheckPtrVsMember,
+ StackFrame::eExpressionPathOptionCheckPtrVsMember
+ | StackFrame::eExpressionPathOptionsAllowDirectIVarAccess,
var,
err);
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp?rev=166860&r1=166859&r2=166860&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp Fri Oct 26 21:54:13 2012
@@ -192,7 +192,9 @@
&identifier_info,
NULL);
- m_external_source->SetMetadata((uintptr_t)new_iface_decl, (uint64_t)isa);
+ ClangASTMetadata meta_data;
+ meta_data.SetISAPtr((uint64_t) isa);
+ m_external_source->SetMetadata((uintptr_t)new_iface_decl, meta_data);
new_iface_decl->setHasExternalVisibleStorage();
@@ -488,7 +490,10 @@
{
lldb::LogSP log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
- ObjCLanguageRuntime::ObjCISA objc_isa = (ObjCLanguageRuntime::ObjCISA)m_external_source->GetMetadata((uintptr_t)interface_decl);
+ ClangASTMetadata *metadata = m_external_source->GetMetadata((uintptr_t)interface_decl);
+ ObjCLanguageRuntime::ObjCISA objc_isa = 0;
+ if (metadata)
+ objc_isa = metadata->GetISAPtr();
if (!objc_isa)
return false;
@@ -591,10 +596,16 @@
if (log)
{
ASTDumper dumper(result_iface_type);
+
+ uint64_t isa_value = LLDB_INVALID_ADDRESS;
+ ClangASTMetadata *metadata = m_external_source->GetMetadata((uintptr_t)result_iface_decl);
+ if (metadata)
+ isa_value = metadata->GetISAPtr();
+
log->Printf("AOCTV::FT [%u] Found %s (isa 0x%llx) in the ASTContext",
current_id,
dumper.GetCString(),
- m_external_source->GetMetadata((uintptr_t)result_iface_decl));
+ isa_value);
}
types.push_back(ClangASTType(ast_ctx, result_iface_type.getAsOpaquePtr()));
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=166860&r1=166859&r2=166860&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Oct 26 21:54:13 2012
@@ -1482,7 +1482,7 @@
const char *property_setter_name,
const char *property_getter_name,
uint32_t property_attributes,
- uint64_t metadata = 0
+ const ClangASTMetadata *metadata
) :
m_ast (ast),
m_class_opaque_type (class_opaque_type),
@@ -1491,9 +1491,32 @@
m_ivar_decl (ivar_decl),
m_property_setter_name (property_setter_name),
m_property_getter_name (property_getter_name),
- m_property_attributes (property_attributes),
- m_metadata (metadata)
+ m_property_attributes (property_attributes)
{
+ if (metadata != NULL)
+ {
+ m_metadata_ap.reset(new ClangASTMetadata());
+ *(m_metadata_ap.get()) = *metadata;
+ }
+ }
+
+ DelayedAddObjCClassProperty (const DelayedAddObjCClassProperty &rhs)
+ {
+ m_ast = rhs.m_ast;
+ m_class_opaque_type = rhs.m_class_opaque_type;
+ m_property_name = rhs.m_property_name;
+ m_property_opaque_type = rhs.m_property_opaque_type;
+ m_ivar_decl = rhs.m_ivar_decl;
+ m_property_setter_name = rhs.m_property_setter_name;
+ m_property_getter_name = rhs.m_property_getter_name;
+ m_property_attributes = rhs.m_property_attributes;
+
+ if (rhs.m_metadata_ap.get())
+ {
+ m_metadata_ap.reset (new ClangASTMetadata());
+ *(m_metadata_ap.get()) = *(rhs.m_metadata_ap.get());
+ }
+
}
bool Finalize() const
@@ -1506,7 +1529,7 @@
m_property_setter_name,
m_property_getter_name,
m_property_attributes,
- m_metadata);
+ m_metadata_ap.get());
}
private:
clang::ASTContext *m_ast;
@@ -1517,7 +1540,7 @@
const char *m_property_setter_name;
const char *m_property_getter_name;
uint32_t m_property_attributes;
- uint64_t m_metadata;
+ std::auto_ptr<ClangASTMetadata> m_metadata_ap;
};
size_t
@@ -1740,7 +1763,7 @@
accessibility,
bit_size);
- GetClangASTContext().SetMetadata((uintptr_t)field_decl, MakeUserID(die->GetOffset()));
+ GetClangASTContext().SetMetadataAsUserID ((uintptr_t)field_decl, MakeUserID(die->GetOffset()));
}
else
{
@@ -1803,6 +1826,8 @@
assert (ivar_decl != NULL);
}
+ ClangASTMetadata metadata;
+ metadata.SetUserID (MakeUserID(die->GetOffset()));
delayed_properties.push_back(DelayedAddObjCClassProperty(GetClangASTContext().getASTContext(),
class_clang_type,
prop_name,
@@ -1811,10 +1836,10 @@
prop_setter_name,
prop_getter_name,
prop_attributes,
- MakeUserID(die->GetOffset())));
+ &metadata));
if (ivar_decl)
- GetClangASTContext().SetMetadata((uintptr_t)ivar_decl, MakeUserID(die->GetOffset()));
+ GetClangASTContext().SetMetadataAsUserID ((uintptr_t)ivar_decl, MakeUserID(die->GetOffset()));
}
}
}
@@ -3906,7 +3931,7 @@
assert(param_var_decl);
function_param_decls.push_back(param_var_decl);
- GetClangASTContext().SetMetadata((uintptr_t)param_var_decl, MakeUserID(die->GetOffset()));
+ GetClangASTContext().SetMetadataAsUserID ((uintptr_t)param_var_decl, MakeUserID(die->GetOffset()));
}
}
}
@@ -5552,20 +5577,22 @@
clang_type = ast.CreateClassTemplateSpecializationType (class_specialization_decl);
clang_type_was_created = true;
- GetClangASTContext().SetMetadata((uintptr_t)class_template_decl, MakeUserID(die->GetOffset()));
- GetClangASTContext().SetMetadata((uintptr_t)class_specialization_decl, MakeUserID(die->GetOffset()));
+ GetClangASTContext().SetMetadataAsUserID ((uintptr_t)class_template_decl, MakeUserID(die->GetOffset()));
+ GetClangASTContext().SetMetadataAsUserID ((uintptr_t)class_specialization_decl, MakeUserID(die->GetOffset()));
}
}
if (!clang_type_was_created)
{
clang_type_was_created = true;
+ ClangASTMetadata metadata;
+ metadata.SetUserID(MakeUserID(die->GetOffset()));
clang_type = ast.CreateRecordType (decl_ctx,
accessibility,
type_name_cstr,
tag_decl_kind,
class_language,
- MakeUserID(die->GetOffset()));
+ &metadata);
}
}
@@ -5768,6 +5795,7 @@
bool is_artificial = false;
dw_offset_t specification_die_offset = DW_INVALID_OFFSET;
dw_offset_t abstract_origin_die_offset = DW_INVALID_OFFSET;
+ dw_offset_t object_pointer_die_offset = DW_INVALID_OFFSET;
unsigned type_quals = 0;
clang::StorageClass storage = clang::SC_None;//, Extern, Static, PrivateExtern
@@ -5821,6 +5849,10 @@
abstract_origin_die_offset = form_value.Reference(dwarf_cu);
break;
+ case DW_AT_object_pointer:
+ object_pointer_die_offset = form_value.Reference(dwarf_cu);
+ break;
+
case DW_AT_allocated:
case DW_AT_associated:
case DW_AT_address_class:
@@ -5831,7 +5863,6 @@
case DW_AT_frame_base:
case DW_AT_high_pc:
case DW_AT_low_pc:
- case DW_AT_object_pointer:
case DW_AT_prototyped:
case DW_AT_pure:
case DW_AT_ranges:
@@ -5851,6 +5882,17 @@
}
}
+ std::string object_pointer_name;
+ if (object_pointer_die_offset != DW_INVALID_OFFSET)
+ {
+ // Get the name from the object pointer die
+ StreamString s;
+ if (DWARFDebugInfoEntry::GetName (this, dwarf_cu, object_pointer_die_offset, s))
+ {
+ object_pointer_name.assign(s.GetData());
+ }
+ }
+
DEBUG_PRINTF ("0x%8.8llx: %s (\"%s\")\n", MakeUserID(die->GetOffset()), DW_TAG_value_to_name(tag), type_name_cstr);
clang_type_t return_clang_type = NULL;
@@ -5884,14 +5926,14 @@
if (die->HasChildren())
{
bool skip_artificial = true;
- ParseChildParameters (sc,
+ ParseChildParameters (sc,
containing_decl_ctx,
- dwarf_cu,
- die,
+ dwarf_cu,
+ die,
skip_artificial,
is_static,
- type_list,
- function_param_types,
+ type_list,
+ function_param_types,
function_param_decls,
type_quals,
template_param_infos);
@@ -5947,7 +5989,7 @@
if (type_handled)
{
LinkDeclContextToDIE(ClangASTContext::GetAsDeclContext(objc_method_decl), die);
- GetClangASTContext().SetMetadata((uintptr_t)objc_method_decl, MakeUserID(die->GetOffset()));
+ GetClangASTContext().SetMetadataAsUserID ((uintptr_t)objc_method_decl, MakeUserID(die->GetOffset()));
}
}
}
@@ -6079,7 +6121,15 @@
type_handled = cxx_method_decl != NULL;
- GetClangASTContext().SetMetadata((uintptr_t)cxx_method_decl, MakeUserID(die->GetOffset()));
+ ClangASTMetadata metadata;
+ metadata.SetUserID(MakeUserID(die->GetOffset()));
+
+ if (!object_pointer_name.empty())
+ {
+ metadata.SetObjectPtrName(object_pointer_name.c_str());
+ printf ("Setting object pointer name: %s on method object 0x%ld.\n", object_pointer_name.c_str(), (uintptr_t) cxx_method_decl);
+ }
+ GetClangASTContext().SetMetadata ((uintptr_t)cxx_method_decl, metadata);
}
}
else
@@ -6145,7 +6195,15 @@
&function_param_decls.front(),
function_param_decls.size());
- GetClangASTContext().SetMetadata((uintptr_t)function_decl, MakeUserID(die->GetOffset()));
+ ClangASTMetadata metadata;
+ metadata.SetUserID(MakeUserID(die->GetOffset()));
+
+ if (!object_pointer_name.empty())
+ {
+ metadata.SetObjectPtrName(object_pointer_name.c_str());
+ printf ("Setting object pointer name: %s on function object 0x%ld.\n", object_pointer_name.c_str(), (uintptr_t) function_decl);
+ }
+ GetClangASTContext().SetMetadata ((uintptr_t)function_decl, metadata);
}
}
type_sp.reset( new Type (MakeUserID(die->GetOffset()),
Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=166860&r1=166859&r2=166860&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Fri Oct 26 21:54:13 2012
@@ -12,6 +12,7 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/Timer.h"
+#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -403,11 +404,13 @@
ClangASTContext &ast = GetClangASTContext();
+ ClangASTMetadata metadata;
+ metadata.SetUserID(0xffaaffaaffaaffaall);
lldb::clang_type_t objc_object_type = ast.CreateObjCClass (name.AsCString(),
ast.GetTranslationUnitDecl(),
isForwardDecl,
isInternal,
- 0xffaaffaaffaaffaall);
+ &metadata);
Declaration decl;
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=166860&r1=166859&r2=166860&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Oct 26 21:54:13 2012
@@ -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;
}
Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=166860&r1=166859&r2=166860&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Fri Oct 26 21:54:13 2012
@@ -60,15 +60,20 @@
if (log)
{
+ lldb::user_id_t user_id;
+ ClangASTMetadata *metadata = GetDeclMetadata(decl);
+ if (metadata)
+ user_id = metadata->GetUserID();
+
if (NamedDecl *named_decl = dyn_cast<NamedDecl>(decl))
log->Printf(" [ClangASTImporter] WARNING: Failed to import a %s '%s', metadata 0x%llx",
decl->getDeclKindName(),
named_decl->getNameAsString().c_str(),
- GetDeclMetadata(decl));
+ user_id);
else
log->Printf(" [ClangASTImporter] WARNING: Failed to import a %s, metadata 0x%llx",
decl->getDeclKindName(),
- GetDeclMetadata(decl));
+ user_id);
}
}
@@ -243,7 +248,7 @@
return true;
}
-uint64_t
+ClangASTMetadata *
ClangASTImporter::GetDeclMetadata (const clang::Decl *decl)
{
DeclOrigin decl_origin = GetDeclOrigin(decl);
@@ -450,6 +455,11 @@
if (log)
{
+ lldb::user_id_t user_id;
+ ClangASTMetadata *metadata = m_master.GetDeclMetadata(from);
+ if (metadata)
+ user_id = metadata->GetUserID();
+
if (NamedDecl *from_named_decl = dyn_cast<clang::NamedDecl>(from))
{
std::string name_string;
@@ -462,7 +472,7 @@
to,
name_string.c_str(),
from,
- m_master.GetDeclMetadata(from));
+ user_id);
}
else
{
@@ -470,7 +480,7 @@
from->getDeclKindName(),
to,
from,
- m_master.GetDeclMetadata(from));
+ user_id);
}
}
Modified: lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp?rev=166860&r1=166859&r2=166860&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp (original)
+++ lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp Fri Oct 26 21:54:13 2012
@@ -27,14 +27,19 @@
g_TotalSizeOfMetadata -= m_metadata.size();
}
-uint64_t ClangExternalASTSourceCommon::GetMetadata (uintptr_t object)
+ClangASTMetadata *
+ClangExternalASTSourceCommon::GetMetadata (uintptr_t object)
{
assert (m_magic == ClangExternalASTSourceCommon_MAGIC);
- return m_metadata[object];
+ if (HasMetadata (object))
+ return &m_metadata[object];
+ else
+ return NULL;
}
-void ClangExternalASTSourceCommon::SetMetadata (uintptr_t object, uint64_t metadata)
+void
+ClangExternalASTSourceCommon::SetMetadata (uintptr_t object, ClangASTMetadata &metadata)
{
assert (m_magic == ClangExternalASTSourceCommon_MAGIC);
@@ -44,7 +49,8 @@
g_TotalSizeOfMetadata += (new_size - orig_size);
}
-bool ClangExternalASTSourceCommon::HasMetadata (uintptr_t object)
+bool
+ClangExternalASTSourceCommon::HasMetadata (uintptr_t object)
{
assert (m_magic == ClangExternalASTSourceCommon_MAGIC);
More information about the lldb-commits
mailing list