diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-02-25 20:01:08 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-02-25 20:01:08 +0000 |
commit | f863ee2949e1dec8f9444cc47983c6030034bb93 (patch) | |
tree | e41e034974eab9b211942bf8736ca45d5b2ef423 /llvm/lib/Linker/LinkModules.cpp | |
parent | 5689a217e303bc4fbba514cbe0491ac44b7081ef (diff) | |
download | bcm5719-llvm-f863ee2949e1dec8f9444cc47983c6030034bb93.tar.gz bcm5719-llvm-f863ee2949e1dec8f9444cc47983c6030034bb93.zip |
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.
llvm-svn: 202190
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r-- | llvm/lib/Linker/LinkModules.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 1bfc8284b81..f1b8cb76106 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -1200,14 +1200,14 @@ bool ModuleLinker::run() { // Inherit the target data from the source module if the destination module // doesn't have one already. - if (DstM->getDataLayout().empty() && !SrcM->getDataLayout().empty()) + if (!DstM->getDataLayout() && SrcM->getDataLayout()) DstM->setDataLayout(SrcM->getDataLayout()); // Copy the target triple from the source to dest if the dest's is empty. if (DstM->getTargetTriple().empty() && !SrcM->getTargetTriple().empty()) DstM->setTargetTriple(SrcM->getTargetTriple()); - if (!SrcM->getDataLayout().empty() && !DstM->getDataLayout().empty() && + if (SrcM->getDataLayout() && DstM->getDataLayout() && SrcM->getDataLayout() != DstM->getDataLayout()) { if (!SuppressWarnings) { errs() << "WARNING: Linking two modules of different data layouts!\n"; |