diff options
Diffstat (limited to 'llvm/lib/IR/DataLayout.cpp')
-rw-r--r-- | llvm/lib/IR/DataLayout.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp index 44410ceb684..d60c79f52e8 100644 --- a/llvm/lib/IR/DataLayout.cpp +++ b/llvm/lib/IR/DataLayout.cpp @@ -344,7 +344,13 @@ void DataLayout::parseSpecifier(StringRef Desc) { } } -DataLayout::DataLayout(const Module *M) { init(M->getDataLayout()); } +DataLayout::DataLayout(const Module *M) { + const DataLayout *Other = M->getDataLayout(); + if (Other) + *this = *Other; + else + init(""); +} void DataLayout::setAlignment(AlignTypeEnum align_type, unsigned abi_align, |