Skip to content
Snippets Groups Projects
Commit 28d9077b authored by Richard Smith's avatar Richard Smith
Browse files

Remove documentation of removed -ast-dump-xml flag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192221 91177308-0d34-0410-b5e6-96231b3b80d8
parent c3dcfa20
No related branches found
No related tags found
No related merge requests found
...@@ -33,9 +33,8 @@ Examining the AST ...@@ -33,9 +33,8 @@ Examining the AST
================= =================
A good way to familarize yourself with the Clang AST is to actually look A good way to familarize yourself with the Clang AST is to actually look
at it on some simple example code. Clang has a builtin AST-dump modes, at it on some simple example code. Clang has a builtin AST-dump mode,
which can be enabled with the flags ``-ast-dump`` and ``-ast-dump-xml``. Note which can be enabled with the flag ``-ast-dump``.
that ``-ast-dump-xml`` currently only works with debug builds of clang.
Let's look at a simple example AST: Let's look at a simple example AST:
...@@ -48,39 +47,25 @@ Let's look at a simple example AST: ...@@ -48,39 +47,25 @@ Let's look at a simple example AST:
} }
# Clang by default is a frontend for many tools; -cc1 tells it to directly # Clang by default is a frontend for many tools; -cc1 tells it to directly
# use the C++ compiler mode. -undef leaves out some internal declarations. # use the C++ compiler mode.
$ clang -cc1 -undef -ast-dump-xml test.cc $ clang -cc1 -ast-dump test.cc
TranslationUnitDecl 0x5aea0d0 <<invalid sloc>>
... cutting out internal declarations of clang ... ... cutting out internal declarations of clang ...
<TranslationUnit ptr="0x4871160"> `-FunctionDecl 0x5aeab50 <test.cc:1:1, line:4:1> f 'int (int)'
<Function ptr="0x48a5800" name="f" prototype="true"> |-ParmVarDecl 0x5aeaa90 <line:1:7, col:11> x 'int'
<FunctionProtoType ptr="0x4871de0" canonical="0x4871de0"> `-CompoundStmt 0x5aead88 <col:14, line:4:1>
<BuiltinType ptr="0x4871250" canonical="0x4871250"/> |-DeclStmt 0x5aead10 <line:2:3, col:24>
<parameters> | `-VarDecl 0x5aeac10 <col:3, col:23> result 'int'
<BuiltinType ptr="0x4871250" canonical="0x4871250"/> | `-ParenExpr 0x5aeacf0 <col:16, col:23> 'int'
</parameters> | `-BinaryOperator 0x5aeacc8 <col:17, col:21> 'int' '/'
</FunctionProtoType> | |-ImplicitCastExpr 0x5aeacb0 <col:17> 'int' <LValueToRValue>
<ParmVar ptr="0x4871d80" name="x" initstyle="c"> | | `-DeclRefExpr 0x5aeac68 <col:17> 'int' lvalue ParmVar 0x5aeaa90 'x' 'int'
<BuiltinType ptr="0x4871250" canonical="0x4871250"/> | `-IntegerLiteral 0x5aeac90 <col:21> 'int' 42
</ParmVar> `-ReturnStmt 0x5aead68 <line:3:3, col:10>
<Stmt> `-ImplicitCastExpr 0x5aead50 <col:10> 'int' <LValueToRValue>
(CompoundStmt 0x48a5a38 <t2.cc:1:14, line:4:1> `-DeclRefExpr 0x5aead28 <col:10> 'int' lvalue Var 0x5aeac10 'result' 'int'
(DeclStmt 0x48a59c0 <line:2:3, col:24>
0x48a58c0 "int result = The toplevel declaration in
(ParenExpr 0x48a59a0 <col:16, col:23> 'int'
(BinaryOperator 0x48a5978 <col:17, col:21> 'int' '/'
(ImplicitCastExpr 0x48a5960 <col:17> 'int' <LValueToRValue>
(DeclRefExpr 0x48a5918 <col:17> 'int' lvalue ParmVar 0x4871d80 'x' 'int'))
(IntegerLiteral 0x48a5940 <col:21> 'int' 42)))")
(ReturnStmt 0x48a5a18 <line:3:3, col:10>
(ImplicitCastExpr 0x48a5a00 <col:10> 'int' <LValueToRValue>
(DeclRefExpr 0x48a59d8 <col:10> 'int' lvalue Var 0x48a58c0 'result' 'int'))))
</Stmt>
</Function>
</TranslationUnit>
In general, ``-ast-dump-xml`` dumps declarations in an XML-style format and
statements in an S-expression-style format. The toplevel declaration in
a translation unit is always the `translation unit a translation unit is always the `translation unit
declaration <http://clang.llvm.org/doxygen/classclang_1_1TranslationUnitDecl.html>`_. declaration <http://clang.llvm.org/doxygen/classclang_1_1TranslationUnitDecl.html>`_.
In this example, our first user written declaration is the `function In this example, our first user written declaration is the `function
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment