diff options
Diffstat (limited to 'lib/IR/Module.cpp')
-rw-r--r-- | lib/IR/Module.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/IR/Module.cpp b/lib/IR/Module.cpp index 739f8888f9..4204c8ef5f 100644 --- a/lib/IR/Module.cpp +++ b/lib/IR/Module.cpp @@ -339,17 +339,21 @@ void Module::addModuleFlag(MDNode *Node) { } void Module::setDataLayout(StringRef Desc) { + DL.reset(Desc); + if (Desc.empty()) { DataLayoutStr = ""; } else { - DL.init(Desc); DataLayoutStr = DL.getStringRepresentation(); + // DataLayoutStr is now equivalent to Desc, but since the representation + // is not unique, they may not be identical. } } void Module::setDataLayout(const DataLayout *Other) { if (!Other) { DataLayoutStr = ""; + DL.reset(""); } else { DL = *Other; DataLayoutStr = DL.getStringRepresentation(); |