This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Fix record members of reference type
ClosedPublic

Authored by tbaeder on Oct 15 2022, 12:28 AM.

Details

Summary
When assigning to them, we can't classify the expression type, because
that doesn't contain the right information.

And when reading from them, we need to do the extra deref, just like we
do when reading from a DeclRefExpr.

Diff Detail

Event Timeline

tbaeder created this revision.Oct 15 2022, 12:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 15 2022, 12:28 AM
tbaeder requested review of this revision.Oct 15 2022, 12:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 15 2022, 12:28 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
tbaeder updated this revision to Diff 468000.Oct 15 2022, 2:32 AM
tbaeder updated this revision to Diff 469580.Oct 21 2022, 6:37 AM
shafik accepted this revision.Oct 24 2022, 10:19 AM

LGTM

clang/lib/AST/Interp/ByteCodeExprGen.cpp
814

What is the effect here or is this just stylistic?

This revision is now accepted and ready to land.Oct 24 2022, 10:19 AM
tbaeder marked an inline comment as done.Oct 24 2022, 8:25 PM
tbaeder added inline comments.
clang/lib/AST/Interp/ByteCodeExprGen.cpp
814
llvm::Optional<PrimType> classify(const Expr *E) const {
  return E->isGLValue() ? PT_Ptr : classify(E->getType());
}
llvm::Optional<PrimType> classify(QualType Ty) const {
  return Ctx.classify(Ty);
}

Passing the full Expr will return PT_Ptr for references.

This revision was automatically updated to reflect the committed changes.
tbaeder marked an inline comment as done.