[PATCH] D33970: Object: Move datalayout check into irsymtab::build. NFCI.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 17:57:19 PDT 2017


pcc created this revision.
Herald added a reviewer: hiraditya.

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


https://reviews.llvm.org/D33970

Files:
  llvm/lib/Object/IRSymtab.cpp


Index: llvm/lib/Object/IRSymtab.cpp
===================================================================
--- llvm/lib/Object/IRSymtab.cpp
+++ llvm/lib/Object/IRSymtab.cpp
@@ -90,6 +90,10 @@
 };
 
 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 @@
     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));
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33970.101650.patch
Type: text/x-patch
Size: 862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170607/d511afbf/attachment.bin>


More information about the llvm-commits mailing list