[PATCH] D37162: [CodeView] Don't output S_UDT records for incomplete typedefs

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 18:09:19 PDT 2017


Look at the example I gave in my updated patch. Just because it knows it's
forward decl doesn't mean a complete decl won't show up *later*
On Fri, Aug 25, 2017 at 6:06 PM Reid Kleckner via Phabricator <
reviews at reviews.llvm.org> wrote:

> rnk added inline comments.
>
>
> ================
> Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:2215
> +  // decl.
> +  TypeIndex TI = getTypeIndex(T);
> +  TypeIndex CTI = getCompleteTypeIndex(T);
> ----------------
> zturner wrote:
> > rnk wrote:
> > > You should be able to dyn_cast to DICompositeType and call
> ->isForwardDecl(). Generally speaking, when translating one representation
> to another, it's better to look at the input and not the output whenever
> possible.
> > >
> > > Actually, is there any reason you can't do that during addToUdts? What
> does the `TI == CTI` comparision achieve?
> > We want to emit a UDT if:
> >
> > 1. This is an enum/struct/union //that has a complete decl//
> > 2. This is a simple type.
> >
> > If we just say `return !T->isForwardDecl();` this doesn't handle the
> case where `T` is a forward decl but a complete decl exists that we could
> remap to.
> >
> > Also, for typedefs, `addToUdts(Ty)` can happen before we know if there
> will ever be a complete decl for `Ty` so this can't happen until the end.
> Re: typedefs, that's what I'm getting at. We don't have to wait to the
> end, because we should have the DICompositeType, and it already knows if
> it's complete or forward.
>
>
> https://reviews.llvm.org/D37162
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170826/7ed38ada/attachment.html>


More information about the llvm-commits mailing list