[llvm] r305023 - Object: Move datalayout check into irsymtab::build. NFCI.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 8 15:04:24 PDT 2017


Author: pcc
Date: Thu Jun  8 17:04:24 2017
New Revision: 305023

URL: http://llvm.org/viewvc/llvm-project?rev=305023&view=rev
Log:
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

Modified:
    llvm/trunk/lib/Object/IRSymtab.cpp

Modified: llvm/trunk/lib/Object/IRSymtab.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/IRSymtab.cpp?rev=305023&r1=305022&r2=305023&view=diff
==============================================================================
--- llvm/trunk/lib/Object/IRSymtab.cpp (original)
+++ llvm/trunk/lib/Object/IRSymtab.cpp Thu Jun  8 17:04:24 2017
@@ -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(Ar
     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));
   }




More information about the llvm-commits mailing list