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

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 18:06:55 PDT 2017


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





More information about the llvm-commits mailing list