We only did this for primitive temporaries. Unfortunately, the existing Pointer::toAPValue() won't do here, since we're expected to set an rvalue on the LifetimeExtendedTemporaryDecl.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thinking about this some more, the new Pointer::toRValue() is probably just the same thing we're already doing in EvalEmitter::emtiRetValue().
I think it mostly makes sense but I want Aaron to also look at it.
clang/lib/AST/Interp/Pointer.cpp | ||
---|---|---|
10 | Are all these headers really needed for the change below? |
clang/lib/AST/Interp/Pointer.cpp | ||
---|---|---|
10 | We access .toAPValue() on all of them in the TYPE_SWITCH below, so yes. |
clang/lib/AST/Interp/ByteCodeExprGen.cpp | ||
---|---|---|
912 | Should this still happen even if TempDecl is null? It looks like getLifetimeExtendedTemporaryDecl() can return a null pointer, but perhaps there's a reason we can't get that result here? | |
clang/lib/AST/Interp/Pointer.cpp | ||
241–243 | Pointer to a field? That means, I would like tests that involve bit-fields. :-) | |
242 | ||
247 | ||
clang/lib/AST/Interp/Record.h | ||
90 | It might make sense to add an assert to both getBase() functions to verify that I is within a valid range. |
Should this still happen even if TempDecl is null? It looks like getLifetimeExtendedTemporaryDecl() can return a null pointer, but perhaps there's a reason we can't get that result here?