コメントで説明されている未定義の動作を超えて、以下は による AST 表現clang++
です。AST は、解析された演算子の優先順位を示します。
満たすためにいくつかのタイプであなたの例をブートストラップする必要がありましたclang++
:
struct SymbolSequence
{
struct Node
{
Node *First;
Node *Last;
Node *Prev;
Node *Next;
};
};
void foo()
{
SymbolSequence::Node *Processing1;
SymbolSequence::Node Traces;
SymbolSequence::Node Discard;
((Traces.Last=new SymbolSequence::Node)->Prev=(Discard.First=Processing1)->Prev)->Next=Traces.Last;
}
AST:
void foo() (CompoundStmt 0x308b6e0 <go.cpp:14:1, line:19:1>
(DeclStmt 0x3088dc8 <line:15:5, col:38>
(0x3088d70 "SymbolSequence::Node *Processing1"))
(DeclStmt 0x30891d8 <line:16:5, col:32>
(0x3088e40 "SymbolSequence::Node Traces =
(CXXConstructExpr 0x30891a8 <col:26> 'struct SymbolSequence::Node':'struct SymbolSequence::Node''void (void)')"))
(DeclStmt 0x30892d8 <line:17:5, col:33>
(0x3089250 "SymbolSequence::Node Discard =
(CXXConstructExpr 0x30892a8 <col:26> 'struct SymbolSequence::Node':'struct SymbolSequence::Node''void (void)')"))
(BinaryOperator 0x308b6b8 <line:18:5, col:99> 'struct SymbolSequence::Node *' lvalue '='
(MemberExpr 0x308b618 <col:5, col:87> 'struct SymbolSequence::Node *' lvalue ->Next 0x3088b60
(ImplicitCastExpr 0x308b600 <col:5, col:84> 'struct SymbolSequence::Node *' <LValueToRValue>
(ParenExpr 0x308b5e0 <col:5, col:84> 'struct SymbolSequence::Node *' lvalue
(BinaryOperator 0x308b5b8 <col:6, col:80> 'struct SymbolSequence::Node *' lvalue '='
(MemberExpr 0x308b448 <col:6, col:46> 'struct SymbolSequence::Node *' lvalue ->Prev 0x3088b00
(ImplicitCastExpr 0x308b430 <col:6, col:43> 'struct SymbolSequence::Node *' <LValueToRValue>
(ParenExpr 0x308b410 <col:6, col:43> 'struct SymbolSequence::Node *' lvalue
(BinaryOperator 0x308b3e8 <col:7, col:39> 'struct SymbolSequence::Node *' lvalue '='
(MemberExpr 0x3089318 <col:7, col:14> 'struct SymbolSequence::Node *' lvalue .Last 0x3088aa0
(DeclRefExpr 0x30892f0 <col:7> 'struct SymbolSequence::Node':'struct SymbolSequence::Node' lvalue Var 0x3088e40 'Traces' 'struct SymbolSequence::Node':'struct SymbolSequence::Node'))
(CXXNewExpr 0x308b390 <col:19, col:39> 'struct SymbolSequence::Node *'
(CXXConstructExpr 0x308b360 <col:23> 'struct SymbolSequence::Node':'struct SymbolSequence::Node''void (void)'))))))
(ImplicitCastExpr 0x308b5a0 <col:51, col:80> 'struct SymbolSequence::Node *' <LValueToRValue>
(MemberExpr 0x308b570 <col:51, col:80> 'struct SymbolSequence::Node *' lvalue ->Prev 0x3088b00
(ImplicitCastExpr 0x308b558 <col:51, col:77> 'struct SymbolSequence::Node *' <LValueToRValue>
(ParenExpr 0x308b538 <col:51, col:77> 'struct SymbolSequence::Node *' lvalue
(BinaryOperator 0x308b510 <col:52, col:66> 'struct SymbolSequence::Node *' lvalue '='
(MemberExpr 0x308b4a0 <col:52, col:60> 'struct SymbolSequence::Node *' lvalue .First 0x3088a40
(DeclRefExpr 0x308b478 <col:52> 'struct SymbolSequence::Node':'struct SymbolSequence::Node' lvalue Var 0x3089250 'Discard' 'struct SymbolSequence::Node':'struct SymbolSequence::Node'))
(ImplicitCastExpr 0x308b4f8 <col:66> 'struct SymbolSequence::Node *' <LValueToRValue>
(DeclRefExpr 0x308b4d0 <col:66> 'struct SymbolSequence::Node *' lvalue Var 0x3088d70 'Processing1' 'struct SymbolSequence::Node *')))))))))))
(ImplicitCastExpr 0x308b6a0 <col:92, col:99> 'struct SymbolSequence::Node *' <LValueToRValue>
(MemberExpr 0x308b670 <col:92, col:99> 'struct SymbolSequence::Node *' lvalue .Last 0x3088aa0
(DeclRefExpr 0x308b648 <col:92> 'struct SymbolSequence::Node':'struct SymbolSequence::Node' lvalue Var 0x3088e40 'Traces' 'struct SymbolSequence::Node':'struct SymbolSequence::Node')))))