public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Question regarding C++ frontend
@ 2008-05-02 15:39 Peter Collingbourne
  2008-05-03 12:29 ` Doug Gregor
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Collingbourne @ 2008-05-02 15:39 UTC (permalink / raw)
  To: gcc

[-- Attachment #1: Type: text/plain, Size: 610 bytes --]

Hi,

In the C++ frontend, record_types maintain list(s) of the parameters
which were used to instantiate the type, one list for each "level" of
the instantiation.  I would like to know how to determine the list of
parameters that were used to instantiate "this" type e.g. in the case of
a type foo<int>::bar<long> I would like the tree_vec containing the type
"long".  Note that we can't always simply extract the last list of
parameters e.g. for the type foo<int>::baz the tree_vec required would
be empty or null whereas the tree_vec available has a single level for
"int".

Thanks,
-- 
Peter

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question regarding C++ frontend
  2008-05-02 15:39 Question regarding C++ frontend Peter Collingbourne
@ 2008-05-03 12:29 ` Doug Gregor
  2008-06-05 16:44   ` Peter Collingbourne
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Gregor @ 2008-05-03 12:29 UTC (permalink / raw)
  To: Peter Collingbourne; +Cc: gcc

On Fri, May 2, 2008 at 11:39 AM, Peter Collingbourne <pcc03@doc.ic.ac.uk> wrote:
>  In the C++ frontend, record_types maintain list(s) of the parameters
>  which were used to instantiate the type, one list for each "level" of
>  the instantiation.  I would like to know how to determine the list of
>  parameters that were used to instantiate "this" type e.g. in the case of
>  a type foo<int>::bar<long> I would like the tree_vec containing the type
>  "long".  Note that we can't always simply extract the last list of
>  parameters e.g. for the type foo<int>::baz the tree_vec required would
>  be empty or null whereas the tree_vec available has a single level for
>  "int".

INNERMOST_TEMPLATE_ARGS can be used to get at the "innermost" TREE_VEC
of template arguments for a class template specialzation such as
foo<int>::bar<long>. CLASSTYPE_USE_TEMPLATE != 0 tells you whether a
RECORD_TYPE is actually a template

  - Doug

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question regarding C++ frontend
  2008-05-03 12:29 ` Doug Gregor
@ 2008-06-05 16:44   ` Peter Collingbourne
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Collingbourne @ 2008-06-05 16:44 UTC (permalink / raw)
  To: Doug Gregor; +Cc: gcc

[-- Attachment #1: Type: text/plain, Size: 957 bytes --]

On Sat, May 03, 2008 at 08:29:25AM -0400, Doug Gregor wrote:
> INNERMOST_TEMPLATE_ARGS can be used to get at the "innermost" TREE_VEC
> of template arguments for a class template specialzation such as
> foo<int>::bar<long>. CLASSTYPE_USE_TEMPLATE != 0 tells you whether a
> RECORD_TYPE is actually a template

Doug,

Thank you for your response and sorry for the delay.  Unfortunately
CLASSTYPE_USE_TEMPLATE does not seem to have this property when the
non-template is an inner class of a template.  For example, the
record_type t pertaining to a class outer<int>::inner_noargs :

(gdb) pt
 <record_type 0x2ae12cb18900 inner_noargs type_5 type_6 VOID
    align 8 symtab 0 alias set -1 canonical type 0x2ae12cb18900 context <record_type 0x2ae12cb180c0 outer>
    no-binfo use_template=1 interface-unknown
    chain <type_decl 0x2ae12cb189c0 inner_noargs>>
(gdb) print t->type.lang_specific->u.c.use_template
$4 = 1

Thanks,
-- 
Peter

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-06-05 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-02 15:39 Question regarding C++ frontend Peter Collingbourne
2008-05-03 12:29 ` Doug Gregor
2008-06-05 16:44   ` Peter Collingbourne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).