Add support for template type/value parameter packs.

- Implements support for two proposed but not yet formalized
  additions to the DWARF spec with regards to variadic template
  parameters. These are nevertheless already being generated by
  gcc under some user extension tags when C++0x is specified.

Fixes #9398.
This commit is contained in:
Rene Gollent
2013-01-22 20:10:45 -05:00
parent b68166e1da
commit 900ce215d3
3 changed files with 146 additions and 1 deletions
+97 -1
View File
@@ -1,6 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2011, Rene Gollent, [email protected].
* Copyright 2011-2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
@@ -2514,6 +2514,96 @@ DIESharedType::AddAttribute_decl_column(uint16 attributeName,
}
// #pragma mark - DIETemplateTypeParameterPack
DIETemplateTypeParameterPack::DIETemplateTypeParameterPack()
:
fName(NULL)
{
}
uint16
DIETemplateTypeParameterPack::Tag() const
{
return DW_TAG_GNU_template_parameter_pack;
}
const char*
DIETemplateTypeParameterPack::Name() const
{
return fName;
}
status_t
DIETemplateTypeParameterPack::AddAttribute_name(uint16 attributeName,
const AttributeValue& value)
{
fName = value.string;
return B_OK;
}
status_t
DIETemplateTypeParameterPack::AddChild(DebugInfoEntry* child)
{
if (child->Tag() == DW_TAG_template_type_parameter) {
fChildren.Add(child);
return B_OK;
}
return DIEDeclaredBase::AddChild(child);
}
// #pragma mark - DIETemplateValueParameterPack
DIETemplateValueParameterPack::DIETemplateValueParameterPack()
:
fName(NULL)
{
}
uint16
DIETemplateValueParameterPack::Tag() const
{
return DW_TAG_GNU_formal_parameter_pack;
}
const char*
DIETemplateValueParameterPack::Name() const
{
return fName;
}
status_t
DIETemplateValueParameterPack::AddAttribute_name(uint16 attributeName,
const AttributeValue& value)
{
fName = value.string;
return B_OK;
}
status_t
DIETemplateValueParameterPack::AddChild(DebugInfoEntry* child)
{
if (child->Tag() == DW_TAG_formal_parameter) {
fChildren.Add(child);
return B_OK;
}
return DIEDeclaredBase::AddChild(child);
}
// #pragma mark - DebugInfoEntryFactory
@@ -2699,6 +2789,12 @@ DebugInfoEntryFactory::CreateDebugInfoEntry(uint16 tag, DebugInfoEntry*& _entry)
case DW_TAG_shared_type:
entry = new(std::nothrow) DIESharedType;
break;
case DW_TAG_GNU_template_parameter_pack:
entry = new(std::nothrow) DIETemplateTypeParameterPack;
break;
case DW_TAG_GNU_formal_parameter_pack:
entry = new(std::nothrow) DIETemplateValueParameterPack;
break;
default:
return B_ENTRY_NOT_FOUND;
break;
@@ -1,5 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2013, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef DEBUG_INFO_ENTRIES_H
@@ -1596,6 +1597,50 @@ private:
};
class DIETemplateTypeParameterPack : public DIEDeclaredBase {
public:
DIETemplateTypeParameterPack();
virtual uint16 Tag() const;
virtual const char* Name() const;
virtual status_t AddAttribute_name(uint16 attributeName,
const AttributeValue& value);
const DebugInfoEntryList& Children() const
{ return fChildren; }
virtual status_t AddChild(DebugInfoEntry* child);
private:
const char* fName;
DebugInfoEntryList fChildren;
};
class DIETemplateValueParameterPack : public DIEDeclaredBase {
public:
DIETemplateValueParameterPack();
virtual uint16 Tag() const;
virtual const char* Name() const;
virtual status_t AddAttribute_name(uint16 attributeName,
const AttributeValue& value);
const DebugInfoEntryList& Children() const
{ return fChildren; }
virtual status_t AddChild(DebugInfoEntry* child);
private:
const char* fName;
DebugInfoEntryList fChildren;
};
// #pragma mark - DebugInfoEntryFactory
+4
View File
@@ -65,6 +65,10 @@ enum {
DW_TAG_condition = 0x3f,
DW_TAG_shared_type = 0x40,
DW_TAG_lo_user = 0x4080,
DW_TAG_GNU_template_parameter_pack
= 0x4107,
DW_TAG_GNU_formal_parameter_pack
= 0x4108,
DW_TAG_hi_user = 0xffff
};