[GCC-XML]reversed line order in gccxml
brad.king at kitware.com
Mon Oct 28 09:00:04 EST 2002
> One of the characteristic of gccxml which i observed is that the
> elements of the xml corresponding line in a c/c++ source code is reversed.
> Is there anyway to reverse this, ie getting the order back from the
> smallest to the largest ?
> I would like the xml files in this order for documentation purpose.
The dump works directly from the GCC internal representation. GCC's
parser builds its representation by pushing new nodes on the front of
linked lists. Later processing reverses some of these lists back to the
proper order, but not all. GCC-XML makes no attempt to sort the
declarations because they are dumped much as a graph would be dumped by a
DFS. C++ source code forms a graph, not a list, so sorting it does not
make sense from the dumper's point of view.
However, one may re-order the XML elements with a post-processing program
to sort them by the location element values. This will order all the
declarations in each source file, but the source files will likely be in
random order, not the preprocessed order.
What do you mean by documentation purposes? Perhaps we can suggest an
alternative approach to solve your specific problem.
More information about the gccxml