Object: Move datalayout check into irsymtab::build. NFCI.

This check is a requirement of the irsymtab builder, not of any
particular caller.

Differential Revision: https://reviews.llvm.org/D33970

llvm-svn: 305023
This commit is contained in:
Peter Collingbourne 2017-06-08 22:04:24 +00:00
parent a9244b57ff
commit dc8c01891f
1 changed files with 4 additions and 4 deletions

View File

@ -90,6 +90,10 @@ struct Builder {
};
Error Builder::addModule(Module *M) {
if (M->getDataLayoutStr().empty())
return make_error<StringError>("input module has no datalayout",
inconvertibleErrorCode());
SmallPtrSet<GlobalValue *, 8> Used;
collectUsedGlobalVariables(*M, Used, /*CompilerUsed*/ false);
@ -277,10 +281,6 @@ static Expected<FileContents> upgrade(ArrayRef<BitcodeModule> BMs) {
if (!MOrErr)
return MOrErr.takeError();
if ((*MOrErr)->getDataLayoutStr().empty())
return make_error<StringError>("input module has no datalayout",
inconvertibleErrorCode());
Mods.push_back(MOrErr->get());
OwnedMods.push_back(std::move(*MOrErr));
}