<div dir="ltr"><div>Hi all,<br></div><div><br></div><div>I am confused on the behavior of Analyzer dealing with DeclRefExpr. For an example:</div><div>1  int a, b;</div><div>2  a = 56;</div><div>3  b = a;</div><div>4  a = b - 8;</div>
<div><br></div><div>I wanted to print the Stmt information in the checkPostStmt(), and I got the results below:</div><div><br></div><div>IntegerLiteral 0x4dbc078 'int' 56</div><div><br></div><div>BinaryOperator 0x4dbc098 'int' '='</div>
<div>|-DeclRefExpr 0x4dbc050 'int' lvalue Var 0x4d8bc80 'a' 'int'</div><div>`-IntegerLiteral 0x4dbc078 'int' 56</div><div><br></div><div>ImplicitCastExpr <b>0x4dbc110 </b>'int' <LValueToRValue></div>
<div>`-DeclRefExpr 0x4dbc0e8 'int' lvalue Var 0x4d8bc80 'a' 'int'</div><div><br></div><div>BinaryOperator 0x4dbc128 'int' '='</div><div>|-DeclRefExpr 0x4dbc0c0 'int' lvalue Var 0x4d8bcf0 'b' 'int'</div>
<div>`-ImplicitCastExpr <b>0x4dbc110 </b>'int' <LValueToRValue></div><div>  `-DeclRefExpr 0x4dbc0e8 'int' lvalue Var 0x4d8bc80 'a' 'int'</div><div><br></div><div>ImplicitCastExpr 0x4dbc1c0 'int' <LValueToRValue></div>
<div>`-DeclRefExpr 0x4dbc178 'int' lvalue Var 0x4d8bcf0 'b' 'int'</div><div><br></div><div>IntegerLiteral 0x4dbc1a0 'int' 8</div><div><br></div><div>BinaryOperator <b>0x4dbc1d8 </b>'int' '-'</div>
<div>|-ImplicitCastExpr 0x4dbc1c0 'int' <LValueToRValue></div><div>| `-DeclRefExpr 0x4dbc178 'int' lvalue Var 0x4d8bcf0 'b' 'int'</div><div>`-IntegerLiteral 0x4dbc1a0 'int' 8</div>
<div><br></div><div>BinaryOperator <b>0x4dbc200 </b>'int' '='</div><div>|-DeclRefExpr 0x4dbc150 'int' lvalue Var 0x4d8bc80 'a' 'int'</div><div>`-BinaryOperator <b>0x4dbc1d8</b> 'int' '-'</div>
<div>  |-ImplicitCastExpr 0x4dbc1c0 'int' <LValueToRValue></div><div>  | `-DeclRefExpr 0x4dbc178 'int' lvalue Var 0x4d8bcf0 'b' 'int'</div><div>  `-IntegerLiteral 0x4dbc1a0 'int' 8</div>
<div><br></div><div>As we know, the Environment provides us  a chance to get the corresponding value of some expression. So, when evaluating the value of BinOp <b>0x4dbc200</b> 'int' '=', it can use the value of BinOp <b>0x4dbc1d8</b> 'int' '-', which has been evaluated already. </div>
<div><br></div><div>Now I want to know that how Analyzer evaluates 'b = a' in Line 3. In other words, how does Analyzer know the value of a when evaluating  ImplicitCastExpr <b>0x4dbc110</b> 'int' <LValueToRValue>? Does Analyzer get the value of a from Environment?</div>
<div><br></div><div>Thanks a lot.</div><div><br></div>-- <br><div dir="ltr"><font color="#444444">Best regards,</font><div><font color="#444444">Arthur Yoo</font></div></div>
</div>