Put all the index expressions on the stack and cast them to SInt64. Then add a new OffsetOf opcode so we can evaluate the index expressions.
Details
Diff Detail
Event Timeline
clang/lib/AST/Interp/ByteCodeExprGen.cpp | ||
---|---|---|
1538–1539 | Shouldn't that be size_t? | |
clang/lib/AST/Interp/Interp.h | ||
1901 | Might be useful to use a small vector here | |
clang/lib/AST/Interp/InterpBuiltin.cpp | ||
590 | This function is the same as IntExprEvaluator::VisitOffsetOfExpr - except for the array case. It's frustrating me but I don't have a good solution |
clang/lib/AST/Interp/Interp.h | ||
---|---|---|
1902 | can you use size_t here? |
clang/lib/AST/Interp/ByteCodeExprGen.cpp | ||
---|---|---|
1538–1539 | The point of the conversion is that we later know the type, i.e. it will be an int64 and we can count on that in OffsetOf(). If we don't do this, we'd have to classify() while interpreting, which is also a possibility. |
Generally looks good but still a few unaddressed comments
clang/lib/AST/Interp/ByteCodeExprGen.cpp | ||
---|---|---|
1538–1539 | I'm happy leaving that as is. |
Shouldn't that be size_t?