[Lldb-commits] [lldb] r143010 - in /lldb/trunk: include/lldb/Symbol/ClangASTContext.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Symbol/ClangASTContext.cpp
Greg Clayton
gclayton at apple.com
Tue Oct 25 20:31:36 PDT 2011
Author: gclayton
Date: Tue Oct 25 22:31:36 2011
New Revision: 143010
URL: http://llvm.org/viewvc/llvm-project?rev=143010&view=rev
Log:
Fixed an issue where a class that resides inside another class wasn't getting
an access specifier set on it, causing an assertion to fire when building
with a Debug+Asserts build of clang.
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
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=143010&r1=143009&r2=143010&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Tue Oct 25 22:31:36 2011
@@ -241,9 +241,10 @@
//------------------------------------------------------------------
lldb::clang_type_t
- CreateRecordType (const char *name,
+ CreateRecordType (clang::DeclContext *decl_ctx,
+ lldb::AccessType access_type,
+ const char *name,
int kind,
- clang::DeclContext *decl_ctx,
lldb::LanguageType language);
static bool
@@ -327,6 +328,7 @@
clang::ClassTemplateDecl *
CreateClassTemplateDecl (clang::DeclContext *decl_ctx,
+ lldb::AccessType access_type,
const char *class_name,
int kind,
const TemplateParameterInfos &infos);
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=143010&r1=143009&r2=143010&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Oct 25 22:31:36 2011
@@ -1237,6 +1237,7 @@
clang::ClassTemplateDecl *
SymbolFileDWARF::ParseClassTemplateDecl (clang::DeclContext *decl_ctx,
+ lldb::AccessType access_type,
const char *parent_name,
int tag_decl_kind,
const ClangASTContext::TemplateParameterInfos &template_param_infos)
@@ -1248,6 +1249,7 @@
ClangASTContext &ast = GetClangASTContext();
return ast.CreateClassTemplateDecl (decl_ctx,
+ access_type,
template_basename.c_str(),
tag_decl_kind,
template_param_infos);
@@ -4042,12 +4044,22 @@
if (clang_type == NULL)
{
clang::DeclContext *decl_ctx = GetClangDeclContextContainingDIE (dwarf_cu, die, NULL);
+ if (accessibility == eAccessNone && decl_ctx)
+ {
+ // Check the decl context that contains this class/struct/union.
+ // If it is a class we must give it an accessability.
+ const clang::Decl::Kind containing_decl_kind = decl_ctx->getDeclKind();
+ if (DeclKindIsCXXClass (containing_decl_kind))
+ accessibility = default_accessibility;
+ }
+
if (type_name_cstr && strchr (type_name_cstr, '<'))
{
ClangASTContext::TemplateParameterInfos template_param_infos;
if (ParseTemplateParameterInfos (dwarf_cu, die, template_param_infos))
{
clang::ClassTemplateDecl *class_template_decl = ParseClassTemplateDecl (decl_ctx,
+ accessibility,
type_name_cstr,
tag_decl_kind,
template_param_infos);
@@ -4064,9 +4076,10 @@
if (!clang_type_was_created)
{
clang_type_was_created = true;
- clang_type = ast.CreateRecordType (type_name_cstr,
+ clang_type = ast.CreateRecordType (decl_ctx,
+ accessibility,
+ type_name_cstr,
tag_decl_kind,
- decl_ctx,
class_language);
}
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=143010&r1=143009&r2=143010&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Tue Oct 25 22:31:36 2011
@@ -448,6 +448,7 @@
clang::ClassTemplateDecl *
ParseClassTemplateDecl (clang::DeclContext *decl_ctx,
+ lldb::AccessType access_type,
const char *parent_name,
int tag_decl_kind,
const lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos);
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=143010&r1=143009&r2=143010&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Oct 25 22:31:36 2011
@@ -1068,7 +1068,7 @@
#pragma mark Structure, Unions, Classes
clang_type_t
-ClangASTContext::CreateRecordType (const char *name, int kind, DeclContext *decl_ctx, LanguageType language)
+ClangASTContext::CreateRecordType (DeclContext *decl_ctx, AccessType access_type, const char *name, int kind, LanguageType language)
{
ASTContext *ast = getASTContext();
assert (ast != NULL);
@@ -1096,11 +1096,18 @@
SourceLocation(),
name && name[0] ? &ast->Idents.get(name) : NULL);
+ if (decl_ctx)
+ {
+ if (access_type != eAccessNone)
+ decl->setAccess (ConvertAccessTypeToAccessSpecifier (access_type));
+ decl_ctx->addDecl (decl);
+ }
return ast->getTagDeclType(decl).getAsOpaquePtr();
}
ClassTemplateDecl *
ClangASTContext::CreateClassTemplateDecl (DeclContext *decl_ctx,
+ lldb::AccessType access_type,
const char *class_name,
int kind,
const TemplateParameterInfos &template_param_infos)
@@ -1184,6 +1191,8 @@
if (class_template_decl)
{
+ if (access_type != eAccessNone)
+ class_template_decl->setAccess (ConvertAccessTypeToAccessSpecifier (access_type));
decl_ctx->addDecl (class_template_decl);
#ifdef LLDB_CONFIGURATION_DEBUG
More information about the lldb-commits
mailing list