[cfe-dev] Detecting implicit constructor calls
Nico Weber
thakis at chromium.org
Fri Nov 5 08:36:30 PDT 2010
Now that the conference is over: Ping :-)
On Tue, Nov 2, 2010 at 1:45 AM, Nico Weber <thakis at chromium.org> wrote:
> Hi,
>
> I'm trying to write a rewriter that turns implicit constructor (`A a =
> 4; f(4);`) calls into explicit constructor calls (`A a(4); f(A(4));`).
> To find out if a constructor call is implicit, I check if the
> CXXConstructExpr is wrapped in a ImplicitCastExpr. This works well,
> except if the implicit conversion happens in a function parameter. In
> that case, clang doesn't create an ImplicitCastExpr.
>
> Is this intentional? If not, the attached patch fixes this. It doesn't
> regress any tests, and it makes clang's ASTs more consistent.
>
> If this is in fact intentional, what's a good way to check if a
> constructor call is implicit?
>
> Thanks,
> Nico
>
More information about the cfe-dev
mailing list