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

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 17:47:11 PDT 2017


zturner added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:2215
+  // decl.
+  TypeIndex TI = getTypeIndex(T);
+  TypeIndex CTI = getCompleteTypeIndex(T);
----------------
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.


https://reviews.llvm.org/D37162





More information about the llvm-commits mailing list