Sometimes the debug information includes artifically-

generated special member functions (constructors,
destructors, etc.) for classes that don't really have
them.  We needed to mark these as artificial to reflect
the debug information; this bug does that for
constructors and destructors.

The "etc." case (certain assignment operators, mostly)
remains to be fixed.

llvm-svn: 143526
This commit is contained in:
Sean Callanan 2011-11-02 01:38:59 +00:00
parent 800f223b12
commit dbb583992a
4 changed files with 53 additions and 28 deletions

View File

@ -280,7 +280,8 @@ public:
bool is_static,
bool is_inline,
bool is_explicit,
bool is_attr_used);
bool is_attr_used,
bool is_artificial);
clang::CXXMethodDecl *
AddMethodToCXXRecordType (lldb::clang_type_t record_opaque_type,
@ -291,7 +292,8 @@ public:
bool is_static,
bool is_inline,
bool is_explicit,
bool is_attr_used)
bool is_attr_used,
bool is_artificial)
{
return ClangASTContext::AddMethodToCXXRecordType (getASTContext(),
@ -303,7 +305,8 @@ public:
is_static,
is_inline,
is_explicit,
is_attr_used);
is_attr_used,
is_artificial);
}
class TemplateParameterInfos

View File

@ -3017,6 +3017,7 @@ ClangExpressionDeclMap::AddOneType(NameSearchContext &context,
const bool is_inline = false;
const bool is_explicit = false;
const bool is_attr_used = false;
const bool is_artificial = false;
ClangASTContext::AddMethodToCXXRecordType (parser_ast_context,
copied_type,
@ -3027,7 +3028,8 @@ ClangExpressionDeclMap::AddOneType(NameSearchContext &context,
is_static,
is_inline,
is_explicit,
is_attr_used);
is_attr_used,
is_artificial);
}
context.AddTypeDecl(copied_type);

View File

@ -4298,6 +4298,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
bool is_static = false;
bool is_virtual = false;
bool is_explicit = false;
bool is_artificial = false;
dw_offset_t specification_die_offset = DW_INVALID_OFFSET;
dw_offset_t abstract_origin_die_offset = DW_INVALID_OFFSET;
@ -4332,6 +4333,8 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
case DW_AT_inline: is_inline = form_value.Unsigned() != 0; break;
case DW_AT_virtuality: is_virtual = form_value.Unsigned() != 0; break;
case DW_AT_explicit: is_explicit = form_value.Unsigned() != 0; break;
case DW_AT_artificial: is_artificial = form_value.Unsigned() != 0; break;
case DW_AT_external:
if (form_value.Unsigned())
@ -4351,11 +4354,9 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
abstract_origin_die_offset = form_value.Reference(dwarf_cu);
break;
case DW_AT_allocated:
case DW_AT_associated:
case DW_AT_address_class:
case DW_AT_artificial:
case DW_AT_calling_convention:
case DW_AT_data_location:
case DW_AT_elemental:
@ -4580,7 +4581,8 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
is_static,
is_inline,
is_explicit,
is_attr_used);
is_attr_used,
is_artificial);
LinkDeclContextToDIE(ClangASTContext::GetAsDeclContext(cxx_method_decl), die);
type_handled = cxx_method_decl != NULL;

View File

@ -1575,7 +1575,8 @@ ClangASTContext::AddMethodToCXXRecordType
bool is_static,
bool is_inline,
bool is_explicit,
bool is_attr_used
bool is_attr_used,
bool is_artificial
)
{
if (!record_opaque_type || !method_opaque_type || !name)
@ -1600,8 +1601,6 @@ ClangASTContext::AddMethodToCXXRecordType
DeclarationName decl_name (&identifier_table->get(name));
const bool is_implicitly_declared = false;
const clang::FunctionType *function_Type = dyn_cast<FunctionType>(method_qual_type.getTypePtr());
if (function_Type == NULL)
@ -1614,29 +1613,34 @@ ClangASTContext::AddMethodToCXXRecordType
unsigned int num_params = method_function_prototype->getNumArgs();
CXXDestructorDecl *cxx_dtor_decl(NULL);
CXXConstructorDecl *cxx_ctor_decl(NULL);
if (name[0] == '~')
{
cxx_method_decl = CXXDestructorDecl::Create (*ast,
cxx_record_decl,
SourceLocation(),
DeclarationNameInfo (ast->DeclarationNames.getCXXDestructorName (ast->getCanonicalType (record_qual_type)), SourceLocation()),
method_qual_type,
NULL,
is_inline,
is_implicitly_declared);
cxx_dtor_decl = CXXDestructorDecl::Create (*ast,
cxx_record_decl,
SourceLocation(),
DeclarationNameInfo (ast->DeclarationNames.getCXXDestructorName (ast->getCanonicalType (record_qual_type)), SourceLocation()),
method_qual_type,
NULL,
is_inline,
is_artificial);
cxx_method_decl = cxx_dtor_decl;
}
else if (decl_name == cxx_record_decl->getDeclName())
{
cxx_method_decl = CXXConstructorDecl::Create (*ast,
cxx_record_decl,
SourceLocation(),
DeclarationNameInfo (ast->DeclarationNames.getCXXConstructorName (ast->getCanonicalType (record_qual_type)), SourceLocation()),
method_qual_type,
NULL, // TypeSourceInfo *
is_explicit,
is_inline,
is_implicitly_declared,
false /*is_constexpr*/);
cxx_ctor_decl = CXXConstructorDecl::Create (*ast,
cxx_record_decl,
SourceLocation(),
DeclarationNameInfo (ast->DeclarationNames.getCXXConstructorName (ast->getCanonicalType (record_qual_type)), SourceLocation()),
method_qual_type,
NULL, // TypeSourceInfo *
is_explicit,
is_inline,
is_artificial,
false /*is_constexpr*/);
cxx_method_decl = cxx_ctor_decl;
}
else
{
@ -1729,6 +1733,20 @@ ClangASTContext::AddMethodToCXXRecordType
cxx_record_decl->addDecl (cxx_method_decl);
if (is_artificial)
{
if (cxx_ctor_decl && cxx_ctor_decl->isCopyConstructor() && cxx_record_decl->hasTrivialCopyConstructor())
{
cxx_ctor_decl->setDefaulted();
cxx_ctor_decl->setTrivial(true);
}
else if (cxx_dtor_decl && cxx_record_decl->hasTrivialDestructor())
{
cxx_dtor_decl->setDefaulted();
cxx_dtor_decl->setTrivial(true);
}
}
#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(cxx_method_decl);
#endif