[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 16:54:50 PDT 2017
rnk added inline comments.
================
Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:2204
+bool CodeViewDebug::shouldEmitUDT(const DIType *T) {
+ // Don't output S_UDT symbols for any regular type that only has a forward
+ // decl, or for any derived type whose non-derived ancestor does only has
----------------
This isn't attached to the null check. It would look better as a function level comment (///).
================
Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:2215
+ // decl.
+ TypeIndex TI = getTypeIndex(T);
+ TypeIndex CTI = getCompleteTypeIndex(T);
----------------
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?
================
Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:2217-2219
+ if (TI == CTI && T->isForwardDecl())
+ return false;
+ return true;
----------------
You can simplify this to return the condition.
https://reviews.llvm.org/D37162
More information about the llvm-commits
mailing list