summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/IRSymtab.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-06-08 22:04:24 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-06-08 22:04:24 +0000
commitdc8c01891f48d6a24f6e87ff00dfafd63262d791 (patch)
tree88169aa6f3eaeb02b9ec6e22ac3bffedda61e71a /llvm/lib/Object/IRSymtab.cpp
parenta9244b57ff3a319961f32facfa551888b8a20279 (diff)
downloadbcm5719-llvm-dc8c01891f48d6a24f6e87ff00dfafd63262d791.tar.gz
bcm5719-llvm-dc8c01891f48d6a24f6e87ff00dfafd63262d791.zip
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
Diffstat (limited to 'llvm/lib/Object/IRSymtab.cpp')
-rw-r--r--llvm/lib/Object/IRSymtab.cpp8
1 files changed, 4 insertions, 4 deletions
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<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));
}
OpenPOWER on IntegriCloud