<div dir="ltr"><div><div>Hi!<br></div>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 pointer.<br><br></div>Does LLVM have any facilities (that I missed), that would help language front-ends in dealing with this sort of expressions?<br>Obviously, clang does it somehow, but  so far I was not able to locate the relevant bit of code.  Any pointers would be appreciated!<br><br><div><div>Vadim<br></div></div></div>