[cfe-commits] [Patch] Missing an entry for CXXContructExpr in the AST XML dumper
Benoit Belley
Benoit.Belley at autodesk.com
Mon Aug 16 14:06:32 PDT 2010
Hi Everyone,
The attached patch adds an entry for CXXConstructExpr in StmtXML.def.
Without this entry, a call to a constructor is dumped as a Stmt_Unsupported when using the AST XML dumper as in:
$ cat foo.cpp
class A {
public:
A();
};
void foo()
{
A a;
}
$ clang -cc1 -ast-print-xml foo.cpp
$ cat foo.xml
...
<Function id="_27" file="f2" line="6" col="6" context="_2" name="foo" type="_12" function_type="_20" num_args="0">
<Body>
<CompoundStmt file="f2" line="7" col="1" endline="9" endcol="1" num_stmts="1">
<DeclStmt file="f2" line="8" col="4" endcol="7">
<Var id="_28" file="f2" line="8" col="6" context="_27" name="a" type="_1E">
*** <Stmt_Unsupported file="f2" line="8" col="6"/>
</Var>
</DeclStmt>
</CompoundStmt>
</Body>
</Function>
...
Add with the patch, one gets instead:
...
<Function id="_27" file="f2" line="6" col="6" context="_2" name="foo" type="_12" function_type="_20" num_args="0">
<Body>
<CompoundStmt file="f2" line="7" col="1" endline="9" endcol="1" num_stmts="1">
<DeclStmt file="f2" line="8" col="4" endcol="7">
<Var id="_28" file="f2" line="8" col="6" context="_27" name="a" type="_1E">
*** <CXXConstructExpr file="f2" line="8" col="6" type="_1E" num_args="0"/>
</Var>
</DeclStmt>
</CompoundStmt>
</Body>
</Function>
...
Benoit
===================================================================
--- include/clang/Frontend/StmtXML.def (revision 110994)
+++ include/clang/Frontend/StmtXML.def (working copy)
@@ -445,6 +445,14 @@
SUB_NODE_SEQUENCE_XML(Expr) // arg1..argN
END_NODE_XML
+NODE_XML(CXXConstructExpr, "CXXConstructExpr") // ctor(arg1, arg2, ...)
+ ATTRIBUTE_FILE_LOCATION_XML
+ TYPE_ATTRIBUTE_XML(getType())
+ ATTRIBUTE_XML(getNumArgs(), "num_args") // unsigned
+ SUB_NODE_XML(Expr) // fnexpr
+ SUB_NODE_SEQUENCE_XML(Expr) // arg1..argN
+END_NODE_XML
+
NODE_XML(CXXNamedCastExpr, "CXXNamedCastExpr") // xxx_cast<type>(expr)
ATTRIBUTE_FILE_LOCATION_XML
TYPE_ATTRIBUTE_XML(getType())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: StmtXML-CXXConstructExpr.patch
Type: application/octet-stream
Size: 861 bytes
Desc: StmtXML-CXXConstructExpr.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100816/3e3a88d4/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100816/3e3a88d4/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.gif
Type: image/gif
Size: 651 bytes
Desc: image002.gif
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100816/3e3a88d4/attachment.gif>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100816/3e3a88d4/attachment-0001.htm>
More information about the cfe-commits
mailing list