[cfe-dev] Clang and XML output

OvermindDL1 overminddl1 at gmail.com
Sun Aug 22 17:17:17 PDT 2010


On Sun, Aug 22, 2010 at 8:54 AM, Matthieu Dubet <maattdd at gmail.com> wrote:
> Hi,
> I'm developing a small C / C++ / ObjC IDE and I plan to use Clang "behind
> the wall" for all the highlighting, completion and semantic stuff about the
> code .
> I know Clang has an -as-xml-output option, but the generated XML is far too
> complicated to be used as is, and I was wondering if there is some function
> I'm not aware about, producing XML (or any markup language) more like this
> tool ( http://42ndart.org/scalpel/demonstration.html ).
>
> int
> main(int argc, char** argv)
> {
> 	std::cout << "Hello, World!" << std::endl;
> 	return 0;
> }
>
> <namespace>
>  <function name="main">
>   <return_type>
>    <built_in_type type="int"/>
>   </return_type>
>   <parameters>
>    <parameter name="argc">
>     <type>
>      <built_in_type type="int"/>
>     </type>
>    </parameter>
>    <parameter name="argv">
>     <type>
>      <pointer>
>       <pointer>
>        <built_in_type type="char"/>
>       </pointer>
>      </pointer>
>     </type>
>    </parameter>
>   </parameters>
>  </function>
> </namespace>

That is not the purpose of the XML, and would actually make things
*vastly* more difficult if it was compared to the current support in
Clang of what you want to do.

For "highlighting, completion and semantic stuff', Clang has libraries
specifically for that, contain just about any information that you
could want, and at a great deal faster and more detailed then the XML
could provide (source code locations, macro expansions (bit-by-bit
even), links to what uses what and where they are used and where
something is instanced and so on and so forth, information that if
dumped into XML form would probably fill the process memory.




More information about the cfe-dev mailing list