Displaying 2 results from an estimated 2 matches for "astrecordlayout".
2015 Jan 02
2
[LLVMdev] Evaluation of offsetof() macro
Hi!
LLVM has a class, ConstantExpr, that is very handy for compile-time
evaluation of const expressions. Unfortunately I cannot find any methods
in it that would be helpful in evaluation of expressions similar to this:
(uintptr_t)(&(*(TYPE*)0).FIELD), which is basically the implementation of
the offsetof(TYPE, FIELD) macro. Specifically, there seem to be no
provisions for dereferencing a
2015 Jan 02
2
[LLVMdev] Evaluation of offsetof() macro
...this sort of expressions?
>> Obviously, clang does it somehow, but so far I was not able to locate the
>> relevant bit of code. Any pointers would be appreciated!
>>
>
> Clang handles record types in a very abstract way, it doesn't rely on LLVM
> IR at any level. An ASTRecordLayout is built for a record type and the
> ASTRecordLayout::getFieldIndex method is used to determine the offset for a
> particular field.
>
So it handles all const expression evaluation in the front-end?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http:...