This is the mail archive of the
mailing list for the GCC project.
Re: How to extract types of variables and its uid?
- From: Swati Rathi <swatirathi at cse dot iitb dot ac dot in>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Thu, 09 Apr 2015 16:11:00 +0530
- Subject: Re: How to extract types of variables and its uid?
- Authentication-results: sourceware.org; auth=none
- References: <55264CFA dot 1000304 at cse dot iitb dot ac dot in> <CAFiYyc1P3CD1LCQ9rV-+dP+7_1CXWDDULvMtzjMdORHwzCzxiw at mail dot gmail dot com>
The variables are declared as you have mentioned.
Also, var1 and var2 are declared in different functions.
On Thursday 09 April 2015 03:30 PM, Richard Biener wrote:
On Thu, Apr 9, 2015 at 11:57 AM, Swati Rathi <email@example.com> wrote:
We want to store all the types associated with the class objects or pointer
to a class in a program.
Consider two variables var1 and var2 declared in different functions as
class IStream *var1;
class IStream *var2;
We are extracting its type as below :
tree type1 = TREE_TYPE (TREE_TYPE (var1));
tree type2 = TREE_TYPE (TREE_TYPE (var2));
TREE_CODE (type1) and TREE_CODE (type2) is RECORD_TYPE.
We wish to record the type struct IStream.
However, when we print TYPE_UID (type1) and TYPE_UID (type2), it is
TYPE_UID = 4326, tree_type : struct IStream
TYPE_UID = 7421, tree_type : struct IStream
Using TYPE_UID (TYPE_MAIN_VARIANT (type1)) and TYPE_UID (TYPE_MAIN_VARIANT
(type2)) also gives the same result.
We wish to avoid duplicate entries of the same type.
How to extract types and uid?
Doesn't it work with