summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2011-11-02 01:38:59 +0000
committerSean Callanan <scallanan@apple.com>2011-11-02 01:38:59 +0000
commitdbb583992a189fbacaaadc833ca89c4be28a1d8a (patch)
treebe3de3054fb46b87e8d4a0a2f44dc66fdb3ce058 /lldb/source
parent800f223b12931aa4618bd7732ba96389d4ccff2a (diff)
downloadbcm5719-llvm-dbb583992a189fbacaaadc833ca89c4be28a1d8a.tar.gz
bcm5719-llvm-dbb583992a189fbacaaadc833ca89c4be28a1d8a.zip
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
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp4
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp8
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp60
3 files changed, 47 insertions, 25 deletions
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index 6c760a720c6..3d5b02400e2 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -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);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 1b8e776b6d4..d10e25484fd 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -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;
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 18d925b2092..c48357c8c3c 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -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
OpenPOWER on IntegriCloud