This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Actually consider ConstantExpr result
ClosedPublic

Authored by tbaeder on Aug 22 2023, 3:28 AM.

Details

Summary
Since we have visitAPValue now, we might as well use it here.

Not really possible to test this, so no test included.

Diff Detail

Event Timeline

tbaeder created this revision.Aug 22 2023, 3:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 22 2023, 3:28 AM
tbaeder requested review of this revision.Aug 22 2023, 3:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 22 2023, 3:28 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
cor3ntin added inline comments.Aug 22 2023, 6:48 AM
clang/lib/AST/Interp/ByteCodeExprGen.cpp
637–645

so if visitAPValue fails, we continue. Couldn't that lead to duplicated diagnostics? Shouldn't we simply return whatever visitAPValue returns unconditionally?

tbaeder added inline comments.Aug 22 2023, 9:41 PM
clang/lib/AST/Interp/ByteCodeExprGen.cpp
637–645

I did it this way because we don't handle all types of APValues in visitAPValue() (think lvalues with an lvalue path), so in those cases we need to visit the expression instead. If there is an APValue we're visting, we're not emitting any diagnostics I think.

FYI there are build failures. you probably need to rebase (visitAPValue does not seem to actually exist)

clang/lib/AST/Interp/ByteCodeExprGen.cpp
637–645

Can you add a comment explaining that? I think it would help! thanks!

FYI there are build failures. you probably need to rebase (visitAPValue does not seem to actually exist)

This depends on the __builtin_offsetof() patch.

tbaeder updated this revision to Diff 556474.Sep 11 2023, 12:23 PM
tbaeder marked 2 inline comments as done.
This revision is now accepted and ready to land.Sep 13 2023, 12:31 PM
This revision was landed with ongoing or failed builds.Sep 14 2023, 12:28 AM
This revision was automatically updated to reflect the committed changes.