Open Quuxplusone opened 12 years ago
Attached test.cpp
(870 bytes, application/octet-stream): Sample C++ program showing default arguments being ignored when passed implicitly
Cloned to rdar://problem/12156507
This is harder than I thought initially because we can't just add the wrapped
expression to the CFG. If you call the function more than once, you'll end up
with the same Expr * showing up more than once, which is usually a Bad Thing.
However, I've put in a fix that works for constant literals in r162453.
(In reply to comment #2)
> This is harder than I thought initially because we can't just add the wrapped
> expression to the CFG. If you call the function more than once, you'll end up
> with the same Expr * showing up more than once, which is usually a Bad Thing.
>
> However, I've put in a fix that works for constant literals in r162453.
Right. Either we can clone the expressions into the CFG, or represent the
initializer expression with a separate CFG that we "stitch together" in the
static analyzer. The first solution is better because it will allow the
compiler warnings to see those expressions as well (as they won't be doing any
stitching via IPA like the analyzer).
test.cpp
(870 bytes, application/octet-stream)