Discussion:
[GCC-XML] Parsing a lot of files...
Luis Paulo Torres
2013-10-06 11:57:22 UTC
Permalink
Hi guys,

I'm trying to parse a C++ file, but my gccxml is parsing to XML a lot
information of another classes from the system
(gccxml_builtins.h, /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/*, etc).

I don't want it. I just want informations from one file (my .cpp file). I
tried do this, but I couldn't solve it. How I can solve it?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gccxml.org/pipermail/gccxml/attachments/20131006/5c8077e8/attachment.htm>
Brad King
2013-10-07 12:15:47 UTC
Permalink
Post by Luis Paulo Torres
I just want informations from one file (my .cpp file).
gccxml dumps the C++ interface of the entire translation unit by walking
the global namespace and dumping everything reachable from it. Instead
you can restrict the starting point with -fxml-start=myname. That will
reduce the output significantly but will still dump the dependencies
of your interfaces. There is no way to restrict it further.

You could also look at Clang which has a library for tool writing:

http://clang.llvm.org/docs/Tooling.html

-Brad
Peter Hackett
2013-10-07 20:05:31 UTC
Permalink
The output of gccxml includes stuff like

<File id="f765"
name="/opt/icmanage/TOOLROOT/2.2/boost1_42/include/boost/memory_order.hpp"/>

and other stuff like

<Enumeration id="_25085" name="memory_order" context="_2196"
location="f765:41"
...

(Note "f765")

You could write a filter to grab only the stuff you care about.

I user Qt's (http://qt-project.org)'s QDomDocument (xml reader/accessor)
to process my gccxml output.
Post by Brad King
Post by Luis Paulo Torres
I just want informations from one file (my .cpp file).
gccxml dumps the C++ interface of the entire translation unit by walking
the global namespace and dumping everything reachable from it. Instead
you can restrict the starting point with -fxml-start=myname. That will
reduce the output significantly but will still dump the dependencies
of your interfaces. There is no way to restrict it further.
http://clang.llvm.org/docs/Tooling.html
-Brad
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.gccxml.org/mailman/listinfo/gccxml
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gccxml.org/pipermail/gccxml/attachments/20131007/87fa7296/attachment.htm>
Luis Paulo Torres
2013-10-07 23:23:56 UTC
Permalink
Thanks for the help, guys!

I'm using QXmlStreamReader to process my outputs, and I tried to use
namespace to filter the classes and functions which I really want. I will
try use these ID/location informations to find the specific fields from my
classes. And after try it with Clang.



2013/10/7 Peter Hackett <peter.hackett at cal.berkeley.edu>
Post by Peter Hackett
The output of gccxml includes stuff like
<File id="f765"
name="/opt/icmanage/TOOLROOT/2.2/boost1_42/include/boost/memory_order.hpp"/>
and other stuff like
<Enumeration id="_25085" name="memory_order" context="_2196"
location="f765:41"
...
(Note "f765")
You could write a filter to grab only the stuff you care about.
I user Qt's (http://qt-project.org)'s QDomDocument (xml reader/accessor)
to process my gccxml output.
Post by Brad King
Post by Luis Paulo Torres
I just want informations from one file (my .cpp file).
gccxml dumps the C++ interface of the entire translation unit by walking
the global namespace and dumping everything reachable from it. Instead
you can restrict the starting point with -fxml-start=myname. That will
reduce the output significantly but will still dump the dependencies
of your interfaces. There is no way to restrict it further.
http://clang.llvm.org/docs/Tooling.html
-Brad
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.gccxml.org/mailman/listinfo/gccxml
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gccxml.org/pipermail/gccxml/attachments/20131007/c0d4161b/attachment.htm>
Loading...