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())



Attachment: StmtXML-CXXConstructExpr.patch
Description: StmtXML-CXXConstructExpr.patch


 
 
 
Benoit Belley
Sr Principal Developer
M&E-Product Development Group    
 
Autodesk Canada Inc. 
10 Rue Duke
Montreal, Quebec  H3C 2L7 
Canada
 
Direct 514 954-7154
 
 

<<attachment: image002.gif>>


 

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to