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
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/AST/Interp/ByteCodeExprGen.cpp | ||
---|---|---|
1421–1422 | Shouldn't that be size_t? | |
clang/lib/AST/Interp/Interp.h | ||
1848 | Might be useful to use a small vector here | |
clang/lib/AST/Interp/InterpBuiltin.cpp | ||
523 | 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 | ||
---|---|---|
1849 | can you use size_t here? |
clang/lib/AST/Interp/ByteCodeExprGen.cpp | ||
---|---|---|
1421–1422 | 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 | ||
---|---|---|
1421–1422 | I'm happy leaving that as is. |
Shouldn't that be size_t?