[GCC-XML] another set of questions after new tests
Nicolas Hognon
nicolas.hognon at gmail.com
Fri Mar 18 05:59:21 EST 2005
Hello,
(sorry if this email is too long)
I continue my evaluation of gcc-xml, so I come with another set of questions.
1. In some case it seems there is some autogenerated type and I do not
understand what is it exactly. for exemple:
<Variable id="_3" name="_ZTIN11MyNamespace10ClassTest3E" type="_11c"
context="_1" location="f0:115" file="f0" line="115"
extern="1" artificial="1"/>
<Variable id="_4" name="_ZTIN11MyNamespace10ClassTest1E" type="_13c"
context="_1" location="f0:15" file="f0" line="15"
extern="1" artificial="1"/>
<CvQualifiedType id="_11c" type="_11" const="1"/>
<CvQualifiedType id="_13c" type="_13" const="1"/>
<Struct id="_11" name="__vmi_class_type_info_pseudo2" context="_1"
mangled="29__vmi_class_type_info_pseudo2" location="f0:115"
file="f0" line="115" members="_21 _22 _23 _24 " bases=""/>
<Struct id="_13" name="__class_type_info_pseudo" context="_1"
mangled="24__class_type_info_pseudo" location="f2:0" file="f2"
line="0" members="" bases=""/>
<Field id="_21" name="" type="_73" context="_11" location="f0:115"
file="f0" line="115"/>
<Field id="_22" name="" type="_74" context="_11" location="f0:115"
file="f0" line="115"/>
<Field id="_23" name="" type="_74" context="_11" location="f0:115"
file="f0" line="115"/>
<Field id="_24" name="" type="_75" context="_11" location="f0:115"
file="f0" line="115"/>
id _3 and _4 are artificial so at this point I can know that they are
"autogenerated" variables.
But how can I detect that id _11 and _13 and fields _21/_22/_23/_24
are "autogenerated" data ?
2. extern="1"
What does it means ?
What is an extern variable/method ?
3. incomplete="1" and class forward
Wwhat does incomplete means ?
How can I detect that a type definition, for exemple a class, is
forward definition.
For exemple when I wrote
class ClassForward;
to avoid including the file where ClassForward is defined.
In this case gcc-xml generate
<Struct id="_19" name="ClassForward" context="_10" incomplete="1"
mangled="N11MyNamespace12ClassForwardE" location="f0:12"
file="f0" line="12"/>
But I also see incomplete in another case (template instantiation, see
one of the following point).
4. What is the different between Class and Struct for gcc-xml ?
5. template
>From my first email on this list I know that gcc-xml does not generate
information about template which is not instantiated. Which is quite
"normal" in fact.
So I wrote the following code
template <class T>
class RefPtr
{
public:
RefPtr();
RefPtr(T* iPointer);
T* operator->() const;
T& operator*() const;
protected:
mutable T* m_Pointee;
};
And then I wrote the following code to have an instantiation of the
template class RefPtr
typedef RefPtr<Object> ObjectPtr;
gcc-xml generate me the following data
<Class id="_4" name="RefPtr<MyNamespace::Object>" context="_3" incomplete="1"
mangled="N11MyNamespace6RefPtrINS_6ObjectEEE" location="f0:10"
file="f0" line="10"/>
<Typedef id="_5" name="ObjectPtr" type="_4" context="_3" location="f0:27"
file="f0" line="27"/>
But there is no other reference to the RefPtr class.
Why the RefPtr<MyNamespace::Object> is tagged as incomplete ?
Why there is no information about methods from the RefPtr class. There
is an instance
of the RefPtr class as I instantiate it with the typedef !
I make some test with template function and in this case it is ok.
If I have
template <class T> T TemplateMethod(const T& a);
and somewhere in the include
int a = TemplateMethod<int>(2);
float b = TemplateMethod<float>(3.0f);
there is in this case two instance of the function TemplateMethod in
the xml file.
6. I think it is time I close this email.
sorry for the long email.
nicolas
More information about the gccxml
mailing list