From dc8c01891f48d6a24f6e87ff00dfafd63262d791 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 8 Jun 2017 22:04:24 +0000 Subject: 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 --- llvm/lib/Object/IRSymtab.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Object/IRSymtab.cpp') diff --git a/llvm/lib/Object/IRSymtab.cpp b/llvm/lib/Object/IRSymtab.cpp index 94f13490939..d21acdb1d55 100644 --- a/llvm/lib/Object/IRSymtab.cpp +++ b/llvm/lib/Object/IRSymtab.cpp @@ -90,6 +90,10 @@ struct Builder { }; Error Builder::addModule(Module *M) { + if (M->getDataLayoutStr().empty()) + return make_error("input module has no datalayout", + inconvertibleErrorCode()); + SmallPtrSet Used; collectUsedGlobalVariables(*M, Used, /*CompilerUsed*/ false); @@ -277,10 +281,6 @@ static Expected upgrade(ArrayRef BMs) { if (!MOrErr) return MOrErr.takeError(); - if ((*MOrErr)->getDataLayoutStr().empty()) - return make_error("input module has no datalayout", - inconvertibleErrorCode()); - Mods.push_back(MOrErr->get()); OwnedMods.push_back(std::move(*MOrErr)); } -- cgit v1.2.3