This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Handle ImplictValueInitExprs
ClosedPublic

Authored by tbaeder on Aug 29 2022, 12:46 AM.

Details

Summary

I don't have a test case handy for them since I'm not sure how to trigger them reliably, but they are easy enough to implement and I ran into them while working on array fillers.

Diff Detail

Event Timeline

tbaeder created this revision.Aug 29 2022, 12:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 29 2022, 12:46 AM
tbaeder requested review of this revision.Aug 29 2022, 12:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 29 2022, 12:46 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
erichkeane accepted this revision.Aug 29 2022, 6:32 AM

I assume we're going to see more patches in the future in this space as you discover examples/tests for this, but in order to unblock other tests, this is good enough for now.

This revision is now accepted and ready to land.Aug 29 2022, 6:32 AM
shafik accepted this revision.Aug 29 2022, 8:12 AM

I don't have a test case handy for them since I'm not sure how to trigger them reliably, but they are easy enough to implement and I ran into them while working on array fillers.

I think we should have test coverage for this if possible. https://godbolt.org/z/75jGrcT7v shows an example, but it might be that it's hard to test that example without other interpreter support first (in which case, you should add the example but comment out any bits that need it so that the test passes, along with a FIXME comment).

tbaeder updated this revision to Diff 456915.Aug 31 2022, 3:16 AM
aaron.ballman accepted this revision.Sep 2 2022, 11:37 AM

LGTM!

clang/test/AST/Interp/arrays.cpp
13

I wish we could find some solution that didn't require this so that the test case breaks when we do get around to implementing support for the other bits. But this is at least a good start!

tbaeder marked an inline comment as done.Sep 3 2022, 12:43 AM
tbaeder added inline comments.
clang/test/AST/Interp/arrays.cpp
13

Usually we could just keep it enabled and add the appropriate expected-error parts, but in this case we run into an assertion later on and that doesn't work.

This revision was landed with ongoing or failed builds.Sep 7 2022, 10:32 PM
This revision was automatically updated to reflect the committed changes.
tbaeder marked an inline comment as done.