[cfe-commits] [Patch] Missing an entry for CXXContructExpr in the AST XML dumper
Douglas Gregor
dgregor at apple.com
Mon Aug 23 07:45:30 PDT 2010
Committed as r111808, thanks!
On Aug 16, 2010, at 2:06 PM, Benoit Belley wrote:
> 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())
>
>
>
> <StmtXML-CXXConstructExpr.patch><ATT00001..htm><image002.gif><ATT00002..htm>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list