r186521 - [analyzer] Handle C++11 member initializer expressions.

Jordan Rose jordan_rose at apple.com
Wed Jul 17 11:17:30 PDT 2013


On Jul 17, 2013, at 11:07 , Eli Friedman <eli.friedman at gmail.com> wrote:

> On Wed, Jul 17, 2013 at 10:16 AM, Jordan Rose <jordan_rose at apple.com> wrote:
>> Author: jrose
>> Date: Wed Jul 17 12:16:42 2013
>> New Revision: 186521
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=186521&view=rev
>> Log:
>> [analyzer] Handle C++11 member initializer expressions.
>> 
>> Previously, we would simply abort the path when we saw a default member
>> initialization; now, we actually attempt to evaluate it. Like default
>> arguments, the contents of these expressions are not actually part of the
>> current function, so we fall back to constant evaluation.
> 
> This sounds strange.  They are not constants in general; the analyzer
> should be able to evaluate them just like an expression written
> directly in the function.  (This is important if, for example, the
> initializer involves a constructor call.)

Yeah, in order to do this properly we'd have to pull the expressions into the CFG. However, the CFG has an implicit invariant that no statement appears more than once, and we'd have to figure out what to do about that to make default args and default init exprs work properly.

We could special-case the initializer case, where the expression only appears once, but Richard's whole purpose for adding this was to handle aggregate initialization, which means this could get reused. This was mostly just to unblock the analyzer for these kinds of expressions.

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130717/700eb9e9/attachment.html>


More information about the cfe-commits mailing list