[cfe-dev] Patch proposal for __builtin_offsetof construct.

Roberto Amadini r.amadini at virgilio.it
Fri Apr 16 03:35:02 PDT 2010


Hi,

I'm the student who is trying to fix the problem mentioned in
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-February/007833.html .

I followed the guidelines described in the previous messages, creating a
dedicated class OffsetOfExpr which doesn't contain any sub-expression.
The offsetof base type is encoded in a TypeSourceInfo field, while
the sub-components are stored in a SmallVector of
OffsetOfExpr::OffsetOfNode (a public struct similar to 
Action::OffsetOfComponent).

Note that the goal of this patch is solely to avoid the unsuitable use of
UnaryOperator for OffsetOf expressions: namely, it is not meant to 
provide a
solution to other FIXME's  (e.g., type-dependent OffsetOfExpr are still 
not handled).
This patch passes all clang tests (it refers to revision 100962), but since
I'm only a beginner in clang development I am note sure about the code I 
wrote,
so any comments and/or suggestions are really welcome.

Regards,
Roberto.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: OffsetOfExpr.patch
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100416/c6817c38/attachment.ksh>


More information about the cfe-dev mailing list