<div dir="ltr">I've figured it out with the help of MemRegionManager::getElementRegion() and MemRegionManager::getFieldRegion().</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-05 21:08 GMT+08:00 Arthur Yoo <span dir="ltr"><<a href="mailto:phjy007@gmail.com" target="_blank">phjy007@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
<p class="MsoNormal"><span style="font-size:10pt">Hi all,</span></p><p class="MsoNormal"><span style="font-size:10pt"><br></span></p>
<p class="MsoNormal"><span style="font-size:10pt">I want to get the </span><span style="font-size:10pt">corresponding</span><span style="font-size:10pt"> MemRegion with a MemberExpr or an ArraySubscriptExpr.</span></p>
<p class="MsoNormal"><span style="font-size:10pt"><br></span></p>
<p class="MsoNormal"><span style="font-size:10pt">For an example:</span></p>
<p class="MsoNormal"><i><span style="font-size:10pt">int arr[10][10][10];</span></i></p>
<p class="MsoNormal"><i><span style="font-size:10pt">arr[3][3][3] = 8;</span></i></p>
<p class="MsoNormal"><i><span style="font-size:10pt">arr[2][3][4] = arr[3][3][3];</span></i><span style="font-size:10pt"></span></p>
<p class="MsoNormal"><span style="font-size:10pt">When evaluating
the statement ‘<i>arr[2][3][4] = arr[3][3][3]</i>’,
I want to get the two MemRegion which represent <i>arr[2][3][4] </i>and<i> arr[2][3][4]</i>
respectively. Since ‘<i>arr[2][3][4] = arr[3][3][3]</i>’ is essentially
an assign operator ‘=’ rooted BinaryOperator Expr, I can get its LHS and RHS
easily. The LHS is a ArraySubscriptExpr that represents the <i>arr[2][3][4]. </i>Although the RHS is an
ImpicitCastExpr (<LValueToRValue>), I can easily get its sub-Expr, which
is also an ArraySubscriptExpr representing the <i>arr[3][3][3]. </i>However, what I really want to get are the MemRegions
(ElementRegions) that representing <i>arr[2][3][4]
</i>and<i> arr[3][3][3] </i>respectively. Is
there any way to get the MemRegions (ElementRegions) through these ArraySubscriptExprs?
</span></p>
<p class="MsoNormal"><span style="font-size:10pt"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt">As for MemberExpr,
here is another example:</span></p>
<p class="MsoNormal"><i><span style="font-size:10pt">typedef struct {</span></i></p>
<p class="MsoNormal"><i><span style="font-size:10pt"> int
a, b;</span></i></p>
<p class="MsoNormal"><i><span style="font-size:10pt">} Obj;</span></i></p>
<p class="MsoNormal"><i><span style="font-size:10pt">Obj o;</span></i></p>
<p class="MsoNormal"><i><span style="font-size:10pt">o.a = 9;</span></i></p>
<p class="MsoNormal"><i><span style="font-size:10pt">o.b = o.a</span></i><span style="font-size:10pt">;</span></p>
<p class="MsoNormal"><span style="font-size:10pt">When evaluating
the statement ‘<i>o.b = o.a</i>’, I want to
get the two MemRegion which represent <i>o.b
</i>and<i> o.b</i> respectively. Quite
similarly with the example above, I can get the two MemberExprs representing <i>o.b </i>and<i> o.b. </i>What I want to know is that, is there any way to get the MemRegions
(FieldRegions) through these MemberExprs? My structure here is quite simple. In
fact, the structure can be nested with tow or more hierarchies. So it means the
MemberExpr can also be nested. </span></p>
<p class="MsoNormal"><span style="font-size:10pt"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt">Any help would be
greatly appreciated. Thanks a lot. </span></p><span class="HOEnZb"><font color="#888888">
<div><br></div>-- <br><div dir="ltr"><font color="#444444">Best regards,</font><div><font color="#444444">Arthur Yoo</font></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><font color="#444444">Best regards,</font><div><font color="#444444">ÔÀ¼ÑÔ² | Yue Jiayuan | Arthur Yoo</font></div></div>
</div>