probably the best C++ parser...

Alexander Neundorf neundorf at
Fri Jul 1 17:18:04 UTC 2005

On Friday 01 July 2005 17:01, Alexander Neundorf wrote:
> can find is gcc, but did you know gccxml
> ( ? 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:


struct EmptyClass {};

int a_function(float f, EmptyClass e)

int main(void)
  return 0;


and the resulting xml:

<?xml version="1.0"?>
  <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" 
    <Argument name="f" type="_6"/>
    <Argument name="e" type="_4"/>
  <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 id="_8" name="EmptyClass" context="_4" location="f0:1"/>
  <ReferenceType id="_9" type="_4c"/>
  <File id="f0" name="example1.cxx"/>

Work: alexander.neundorf at -
Home: neundorf at                -
      alex at               -

More information about the KDevelop-devel mailing list