[Lldb-commits] [lldb] r179296 - Static variables inside classes were not being added to the RecordDecl, now they are. This gets us closer to being able to display static variables in classes.
Greg Clayton
gclayton at apple.com
Thu Apr 11 09:57:51 PDT 2013
Author: gclayton
Date: Thu Apr 11 11:57:51 2013
New Revision: 179296
URL: http://llvm.org/viewvc/llvm-project?rev=179296&view=rev
Log:
Static variables inside classes were not being added to the RecordDecl, now they are. This gets us closer to being able to display static variables in classes.
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=179296&r1=179295&r2=179296&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Apr 11 11:57:51 2013
@@ -336,6 +336,26 @@ public:
bitfield_bit_size);
}
+ clang::VarDecl *
+ AddVariableToRecordType (lldb::clang_type_t record_opaque_type,
+ const char *name,
+ lldb::clang_type_t var_opaque_type,
+ lldb::AccessType access)
+ {
+ return ClangASTContext::AddVariableToRecordType (getASTContext(),
+ record_opaque_type,
+ name,
+ var_opaque_type,
+ access);
+ }
+
+ static clang::VarDecl *
+ AddVariableToRecordType (clang::ASTContext *ast,
+ lldb::clang_type_t record_opaque_type,
+ const char *name,
+ lldb::clang_type_t var_opaque_type,
+ lldb::AccessType access);
+
static void
BuildIndirectFields (clang::ASTContext *ast,
lldb::clang_type_t record_qual_type);
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=179296&r1=179295&r2=179296&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Apr 11 11:57:51 2013
@@ -1685,7 +1685,18 @@ SymbolFileDWARF::ParseChildMembers
// Skip static members
if (is_external && member_byte_offset == UINT32_MAX)
+ {
+ Type *var_type = ResolveTypeUID(encoding_uid);
+
+ if (var_type)
+ {
+ GetClangASTContext().AddVariableToRecordType (class_clang_type,
+ name,
+ var_type->GetClangLayoutType(),
+ accessibility);
+ }
break;
+ }
if (is_artificial == false)
{
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=179296&r1=179295&r2=179296&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Apr 11 11:57:51 2013
@@ -1990,10 +1990,10 @@ ClangASTContext::AddFieldToRecordType
}
}
- field->setAccess (ConvertAccessTypeToAccessSpecifier (access));
-
if (field)
{
+ field->setAccess (ConvertAccessTypeToAccessSpecifier (access));
+
record_decl->addDecl(field);
#ifdef LLDB_CONFIGURATION_DEBUG
@@ -2008,18 +2008,63 @@ ClangASTContext::AddFieldToRecordType
{
bool is_synthesized = false;
field = ClangASTContext::AddObjCClassIVar (ast,
- record_clang_type,
- name,
- field_type,
- access,
- bitfield_bit_size,
- is_synthesized);
+ record_clang_type,
+ name,
+ field_type,
+ access,
+ bitfield_bit_size,
+ is_synthesized);
}
}
}
return field;
}
+clang::VarDecl *
+ClangASTContext::AddVariableToRecordType (clang::ASTContext *ast,
+ lldb::clang_type_t record_opaque_type,
+ const char *name,
+ lldb::clang_type_t var_type,
+ AccessType access)
+{
+ clang::VarDecl *var_decl = NULL;
+
+ if (record_opaque_type == NULL || var_type == NULL)
+ return NULL;
+
+ IdentifierTable *identifier_table = &ast->Idents;
+
+ assert (ast != NULL);
+ assert (identifier_table != NULL);
+
+ const RecordType *record_type = dyn_cast<RecordType>(QualType::getFromOpaquePtr(record_opaque_type).getTypePtr());
+
+ if (record_type)
+ {
+ RecordDecl *record_decl = record_type->getDecl();
+
+ var_decl = VarDecl::Create (*ast, // ASTContext &
+ record_decl, // DeclContext *
+ SourceLocation(), // SourceLocation StartLoc
+ SourceLocation(), // SourceLocation IdLoc
+ name ? &identifier_table->get(name) : NULL, // IdentifierInfo *
+ QualType::getFromOpaquePtr(var_type), // Variable QualType
+ NULL, // TypeSourceInfo *
+ SC_Static); // StorageClass
+ if (var_decl)
+ {
+ var_decl->setAccess(ConvertAccessTypeToAccessSpecifier (access));
+ record_decl->addDecl(var_decl);
+
+#ifdef LLDB_CONFIGURATION_DEBUG
+ VerifyDecl(var_decl);
+#endif
+ }
+ }
+ return var_decl;
+}
+
+
static clang::AccessSpecifier UnifyAccessSpecifiers (clang::AccessSpecifier lhs,
clang::AccessSpecifier rhs)
{
More information about the lldb-commits
mailing list