正在加载图片...
Example:Clang AST Dump Usage(linux): 1$clang -Xclang -ast-dump -fsyntax-only a.c Example code: 1 int f(int a,int b){if (b ==0)return a;else {..} The AST: 1 -FunctionDecl used f 'int (int,int)' 2 -ParmVarDecl used a 'int' 3 I-ParmVarDecl used b 'int' -CompoundStmt 5 -IfStmt 6 |-BinaryOperator 'int'' 7 -ImplicitCastExpr 'int' 8 -DeclRefExpr 'int'lvalue ParmVar 'b''int' 9 -IntegerLiteral 'int'0 10 -ReturnStmt 11 -ImplicitCastExpr 'int' 12 -DeclRefExpr 'int'lvalue ParmVar 'a''int' 13Example: Clang AST Dump Example code: The AST: Usage (linux): 1 $ clang -Xclang -ast-dump -fsyntax-only a.c 1 int f(int a, int b) { if (b == 0) return a; else { ... } } 1 |-FunctionDecl used f 'int (int, int)' 2 | |-ParmVarDecl used a 'int' 3 | |-ParmVarDecl used b 'int' 4 | `-CompoundStmt 5 | `-IfStmt 6 | |-BinaryOperator 'int' '==' 7 | | |-ImplicitCastExpr 'int' 8 | | | `-DeclRefExpr 'int' lvalue ParmVar 'b' 'int' 9 | | `-IntegerLiteral 'int' 0 10 | |-ReturnStmt 11 | | `-ImplicitCastExpr 'int' 12 | | `-DeclRefExpr 'int' lvalue ParmVar 'a' 'int' 13 | `-
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有