[cfe-dev] Detecting implicit constructor calls

Nico Weber thakis at chromium.org
Mon Nov 1 22:45:25 PDT 2010


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ice.patch
Type: application/octet-stream
Size: 1264 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101102/6630db22/attachment.obj>


More information about the cfe-dev mailing list