summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/llvm/IR/DataLayout.h4
-rw-r--r--lib/IR/DataLayout.cpp6
2 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/IR/DataLayout.h b/include/llvm/IR/DataLayout.h
index 5eb186d..4d3016c 100644
--- a/include/llvm/IR/DataLayout.h
+++ b/include/llvm/IR/DataLayout.h
@@ -181,6 +181,10 @@ public:
~DataLayout(); // Not virtual, do not subclass this class
+ /// DataLayout is an immutable pass, but holds state. This allows the pass
+ /// manager to clear its mutable state.
+ bool doFinalization(Module &M);
+
/// Parse a data layout string (with fallback to default values). Ensure that
/// the data layout pass is registered.
void init(StringRef LayoutDescription);
diff --git a/lib/IR/DataLayout.cpp b/lib/IR/DataLayout.cpp
index f09de3a..4100c4f 100644
--- a/lib/IR/DataLayout.cpp
+++ b/lib/IR/DataLayout.cpp
@@ -438,6 +438,12 @@ DataLayout::~DataLayout() {
delete static_cast<StructLayoutMap*>(LayoutMap);
}
+bool DataLayout::doFinalization(Module &M) {
+ delete static_cast<StructLayoutMap*>(LayoutMap);
+ LayoutMap = 0;
+ return false;
+}
+
const StructLayout *DataLayout::getStructLayout(StructType *Ty) const {
if (!LayoutMap)
LayoutMap = new StructLayoutMap();