[patch] properly escape strings in xml output + re-enable utest for ast-print-xml

hi,

this patch properly addresses escaping < and > which might appear
(e.g. for C++ operators) in the xml dump.

I also re-enabled the unit test for ast-print-xml (or so I think)
at least, make test didn't fail...

cheers,
sebastien.

ENOPATCH :slight_smile:

Excerpts from Chris Lattner's message of 2010-05-11 19:04:16 +0200:

ENOPATCH :slight_smile:

arf !

properly.escape.strings.patch (2 KB)

Is this hunk intended?

+++ lib/Frontend/DeclXML.cpp (working copy)
@@ -49,7 +49,7 @@
     addSubNodes(cast<RecordDecl>(RD));

     if (RD->isDefinition()) {
- Doc.addAttribute("num_bases", RD->getNumBases());
+ //Doc.addAttribute("num_bases", RD->getNumBases());

-Chris

Excerpts from Chris Lattner's message of 2010-05-11 19:13:42 +0200:

> Excerpts from Chris Lattner's message of 2010-05-11 19:04:16 +0200:
>> ENOPATCH :slight_smile:
>
> arf !

Is this hunk intended?

+++ lib/Frontend/DeclXML.cpp (working copy)
@@ -49,7 +49,7 @@
     addSubNodes(cast<RecordDecl>(RD));

     if (RD->isDefinition()) {
- Doc.addAttribute("num_bases", RD->getNumBases());
+ //Doc.addAttribute("num_bases", RD->getNumBases());

yes (I should indeed have documented it)
the problem is that by re-using the dumping code for RecordDecl, the
CXXRecordDecl node is already closed by the time one tries to add this
new num_bases attribute.

something better needs to be done here, but fixing the XML generation
was the priority :slight_smile:

cheers,
sebastien.

Thanks, applied in r103671