probably the best C++ parser...

Matt Rogers mattr at kde.org
Sun Jul 3 19:25:06 UTC 2005


On Friday 01 July 2005 10:17 am, Alexander Neundorf wrote:
> On Friday 01 July 2005 17:01, Alexander Neundorf wrote:
> > ...you can find is gcc, but did you know gccxml
> > (http://www.gccxml.org/HTML/Index.html) ? It's basically the real gcc,
> > but it doesn't produce machine instructions, but an xml file describing
> > the source file.
> > So you get
> > -all functions
> > -all variables
> > -all parameters for functions
> > -the locations where the functions are declared (file and line number)
> > etc. in a machine-readable format.
>
> Here's a very simple example:
>
> ----------8<-----------8<--------------8<-----------
>
> struct EmptyClass {};
>
> int a_function(float f, EmptyClass e)
> {
> }
>
> int main(void)
> {
>   return 0;
> }
>
> ----------8<-----------8<--------------8<-----------
>
> and the resulting xml:
>
> <?xml version="1.0"?>
> <GCC_XML>
>   <Namespace id="_1" name="::" members="_2 _3 _4 "/>
>   <Function id="_2" name="main" returns="_5" context="_1" location="f0:8"/>
>   <Function id="_3" name="a_function" returns="_5" context="_1"
> location="f0:4">
>     <Argument name="f" type="_6"/>
>     <Argument name="e" type="_4"/>
>   </Function>
>   <Struct id="_4" name="EmptyClass" context="_1" location="f0:1"
> members="_7 _8 " bases=""/>
>   <FundamentalType id="_5" name="int"/>
>   <FundamentalType id="_6" name="float"/>
>   <Constructor id="_7" name="EmptyClass" context="_4" location="f0:1">
>     <Argument name="_ctor_arg" type="_9"/>
>   </Constructor>
>   <Constructor id="_8" name="EmptyClass" context="_4" location="f0:1"/>
>   <ReferenceType id="_9" type="_4c"/>
>   <File id="f0" name="example1.cxx"/>
> </GCC_XML>
>
> Alex

That's all well and good, except for the fact that XML parsing (at least with 
Qt, and possibly other libraries as well) is way too slow to be useful in 
this case (especially since we're using bdb)

Now, if Ian would hurry up and replace bdb with something else then maybe 
speed wouldn't be such an issue. Also, I've seen other posts that say that 
gccxml doesn't provided everything needed for refactoring support, etc., but 
I don't know that for sure, so i'm just quoting what the other person said. 

I like this idea, but I'm wondering if there are other issues lurking here 
that we're not yet aware of

-- 
Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20050703/055dedb3/attachment.sig>


More information about the KDevelop-devel mailing list