<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On May 27, 2014, at 10:57 , Aitor San Juan <<a href="mailto:aitor.sj@opendeusto.es">aitor.sj@opendeusto.es</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div><div>Jordan, thanks for the comments.<br><br></div>Doubts (1) and (2) are now clear to me.<br><br></div><div>With regard to point (3), I didn't know <span style="font-family:courier new,monospace"><i>MemRegion</i></span>s can also be saved as custom ProgramState information, the same way as <span style="font-family:courier new,monospace"><i>SymbolRef</i></span>s. So to be able to keep track of which variables currently point to a String literal, if I haven't misunderstood you, I've tried saving as the checker's custom ProgramState information a MemRegion. In this scenario, I'm only interested in whether a <i>char *</i> variable points to a String literal or not. So instead of registering a Map with ProgramState, I think is enough to use a Set that contains variable which point to a String literal at any given time. Thus, if a given variable does not exist in the Set, the checker can assume it doesn't point to a String literal. I've done the registering with ProgramState as:<br>
<br><span style="font-family:courier new,monospace">typedef const MemRegion * MemRegionRef; <i><span style="font-family:arial,helvetica,sans-serif">// This typedef does not officially exist, so I've privately defined it to the checker as a helper<br>
</span></i>REGISTER_SET_WITH_PROGRAMSTATE(StrLit, MemRegionRef)<br></span><br>So far, so good. No run-time error for the time being. However, when I retrieve the current State and try to add/remove an <i>interested</i> variable (what I actually add/remove is its MemRegion), nothing happens. The method "contains" always returns false.</div>
<div> </div><div>I wonder if this approach (using a Set) is correct. I see that the contents of the ProgramState, are, for example, ElementRegions. Is it a matter of casting, as you pointed out in your previous comments?<br>
</div></div></blockquote><br></div><div>What you've done ought to work (if you're being careful about the region that represents the <i>pointer variable</i> and the region that represents what it points <i>to)</i>, but again it'd be far easier to just ask if the MemRegion is a StringRegion.</div><div><br></div><div>Jordan</div><br></body></html>