This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Template function support
- From: sami wagiaalla <swagiaal at redhat dot com>
- To: Project Archer <archer at sourceware dot org>
- Date: Thu, 10 Jun 2010 14:43:07 -0400
- Subject: Template function support
I thought I would wright a summery of what I have been up to since this
work has taken a while now.
The original motivation for this work was to provide support for the
following senario
template<typename T>
int foo(T){
return 11;
}
int main (){
return foo(1);
}
(gdb) print foo(1)
Currently foo would be stored in the symbol table as foo<int>()
My idea was to remove <int> from foo<int>() and store it just as plain
foo. This would allow for normal overload resolution to take place. The
patch attached to this message demonstrates that approach.
The problem I ran into is that if the user does this:
(gdb) print foo
then foo<int> is printed
or in the case of a class like:
template<typename T>
class B{};
(gdb) ptype B
would return the first found template *instance*
To fix this problem I plan to take a suggestion made by Tom which is to
add a meta variable corresponding to a group of instance of the same
template. This variable will enable the consumer of the lookup (printing
code, evaluation code, overload resolution code, or breakpoint code) to
do something sensible when this type of symbol is encountered.
The scope of this has expanded but the good news is that we will solve
more problems with this extension.
Any comments ?
Sami
Warning: the attached patch might be severely not GNU formatted :)
Attachment:
search_name.patch
Description: Text document