[PATCH] D100388: [BROKEN][clang] Try to fix thunk function types
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 12 13:09:26 PDT 2021
efriedma added inline comments.
================
Comment at: clang/lib/CodeGen/CGVTables.cpp:467
+ if (!CalleeMD->isDefined()) {
+ CGM.ErrorUnsupported(ThunkGD.getDecl(), "thunk for forward declaration");
+ return;
----------------
lebedev.ri wrote:
> efriedma wrote:
> > "IsUnprototyped" means that we have to generate a thunk, but we don't have the proper types. We emit some special IR with known incorrect types, and mark it with the "thunk" attribute to let the optimizer know what we're doing.
> >
> > It should be fine to continue using a fake type on the IsUnprototyped codepath.
> `IsUnprototyped` is false here for that test though..
Oh, hmm, right. My comment still holds, but doesn't apply to that test.
In that test, the derived class method is defined, but the base class method isn't. You should be able to compute the LLVM function type for the base class method in that case. The types have to be the same, barring pointer variance, so being able to compute the type of the derived class method implies you can compute the type of the base class method.
So I'm not sure why you'd need to error out in that case; the computation should work the same way whether or not we can see the definition of the base class method.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100388/new/
https://reviews.llvm.org/D100388
More information about the cfe-commits
mailing list