[PATCH] D79900: [BitcodeReader] datalayout must be specified before it is queried.

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 14 11:57:46 PDT 2020


jdoerfert accepted this revision.
jdoerfert added a comment.

LGTM



================
Comment at: llvm/lib/Bitcode/Reader/BitcodeReader.cpp:3445
+    TheModule->setDataLayout(DL);
+  };
+
----------------
efriedma wrote:
> jdoerfert wrote:
> > mehdi_amini wrote:
> > > jdoerfert wrote:
> > > > efriedma wrote:
> > > > > jdoerfert wrote:
> > > > > > Should we emit an error here? I mean, can it happen we now silently ignore the DL or triple and the user is baffled what is happening?
> > > > > We print an error if we see MODULE_CODE_DATALAYOUT or MODULE_CODE_TRIPLE after ResolveDataLayout runs.
> > > > I guess we could test that?
> > > That would require crafting manually some invalid bitcode wouldn't it?
> > Yes, or better, something we now call invalid. @efriedma please correct me but there could be an input we accepted before but not now? 
> Yes.  But no tools exist to generate such a file.
> 
> I don't really want to sink a day into constructing a framework for BitcodeReader unittests, but if you think it's necessary, I guess I can.
No, it was more of an idea, not a request. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79900/new/

https://reviews.llvm.org/D79900





More information about the llvm-commits mailing list