[cfe-dev] Adding type source info to ImplicitValueInitExpr.
zaffanella at cs.unipr.it
Sat Feb 13 05:18:41 PST 2010
John McCall wrote:
> On Jan 18, 2010, at 5:24 PM, Abramo Bagnara wrote:
>> Il 18/01/2010 22:33, John McCall ha scritto:
>>> On Jan 18, 2010, at 3:21 AM, Enea Zaffanella wrote:
>>>> The attached patch adds (optional) type source info to class
>>>> ImplicitValueInitExpr: the type source info will have a valid value
>>>> if the ImplicitValueInitExpr results from __builtin_offsetof
>>> I think we'd rather not take this. The primary use of
>>> ImplicitValueInitExpr does not involve a type written in the source;
>>> in fact, it involves no source code at all. This patch is useful
>>> solely because of the current implementation of __builtin_offsetof.
>>> That implementation is terrible, and it's long past time for
>>> __builtin_offsetof to get its own AST class. When that happens, this
>>> patch will be unnecessary.
A student of mine would like to have a try fixing the thing above
(a.k.a., PR 5390), unless there already is someone working on it.
The approach we would follows is as follows:
1) Take out OffsetOf from UnaryOperator::OpCode and have instead a
dedicated class inheriting from Expr (OffsetOfExpr).
2) Create a new class OffsetOfBaseExpr that will replace current
(ab-)uses of ImplicitValueInitExpr in the context of the new class
above: this new class will embed a TypeSourceInfo object, so as to be
able to provide suitable source location info.
Would that be OK?
More information about the cfe-dev