[cfe-dev] CXXForRangeStmtClass in Static Analyzer
Jim Goodnow II
Jim at TheGoodnows.net
Thu Sep 22 19:49:47 PDT 2011
On 9/22/2011 5:22 PM, Ted Kremenek wrote:
>
> On Sep 22, 2011, at 5:03 PM, Jim Goodnow II wrote:
>
>> Just curious. Is there any reason that CXXForRangeStmtClass isn't
>> treated the same as ForStmtClass in ExprEngine?
>
> They shouldn't be treated the same because they aren't the same
> semantically. In the AST their common ancestor is Stmt; they need to
> be handled separately.
>
>> It shouldn't appear explicitly in the CFG since it is already handled
>> by the semantic engine.
>
> The CFG is suppose to represent all control-flow, including this
> statement. What do you mean by the "semantic engine"?
>
Yes, it is true that they are not the same semantically, but when the
AST is generated, the semantics of the ForRange and For are replaced
with the appropriate statements that implement the semantics by
initializing, incrementing, comparing and branching. So, the CFG does
model both statement types with other explicit statements which is why
the For never appears explicitly in the CFG. The same should hold true
for the ForRange. I'm just suggesting that the CXXForRangeStmtClass case
be moved from the 'unsupported' part of the switch to the section with
For, Break, Continue, etc. Now, the ObjectiveC ForCollection statement
may be handled differently which may require it to be explicitly handled
in the CFG and in the analyzer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110922/844db8cf/attachment.html>
More information about the cfe-dev
mailing list