From aab87fe0ec98072580586850ed00bac3d00df6c0 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 25 Feb 2014 20:01:08 +0000 Subject: Store a DataLayout in Module. Now that DataLayout is not a pass, store one in Module. Since the C API expects to be able to get a char* to the datalayout description, we have to keep a std::string somewhere. This patch keeps it in Module and also uses it to represent modules without a DataLayout. Once DataLayout is mandatory, we should probably move the string to DataLayout itself since it won't be necessary anymore to represent the special case of a module without a DataLayout. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202190 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/opt/opt.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'tools/opt/opt.cpp') diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 19adf78cd3..2b209d99c7 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -429,11 +429,8 @@ int main(int argc, char **argv) { Passes.add(TLI); // Add an appropriate DataLayout instance for this module. - DataLayout *DL = 0; - const std::string &ModuleDataLayout = M.get()->getDataLayout(); - if (!ModuleDataLayout.empty()) - DL = new DataLayout(ModuleDataLayout); - else if (!DefaultDataLayout.empty()) + const DataLayout *DL = M.get()->getDataLayout(); + if (!DL && !DefaultDataLayout.empty()) DL = new DataLayout(DefaultDataLayout); if (DL) -- cgit v1.2.3