[PATCH] D27775: [ThinLTO] Import composite types as declarations

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 11:41:27 PST 2017


tejohnson added inline comments.


================
Comment at: llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp:750
+        TemplateParams = getMDOrNull(Record[14]);
+      }
       DICompositeType *CT = nullptr;
----------------
aprantl wrote:
> Sorry for bringing this up so late, but I just realized that this is only legal if the `Identifier` field is nonempty. The ODR (or an equivalent rule in the underlying source language) only applies to types with an identifier field. In C, for example, it is legal for multiple translation units to contain definitions of types with the same name, but a different layout. Using just the name it is impossible for the debugger to find the correct definition of a forward-declared type in the other translation units.
Ok, I can make the decl optimization conditional on the Identifier being non-null. I assume that is not the common case anyway - in which case that change shouldn't hurt the overall impact much?


Repository:
  rL LLVM

https://reviews.llvm.org/D27775





More information about the llvm-commits mailing list