summaryrefslogtreecommitdiff
path: root/include/llvm/IR/Metadata.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/IR/Metadata.h')
-rw-r--r--include/llvm/IR/Metadata.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/include/llvm/IR/Metadata.h b/include/llvm/IR/Metadata.h
index 3462cc02fd27..bc0b87a6c348 100644
--- a/include/llvm/IR/Metadata.h
+++ b/include/llvm/IR/Metadata.h
@@ -958,6 +958,9 @@ public:
/// \pre No operands (or operands' operands, etc.) have \a isTemporary().
void resolveCycles();
+ /// Resolve a unique, unresolved node.
+ void resolve();
+
/// \brief Replace a temporary node with a permanent one.
///
/// Try to create a uniqued version of \c N -- in place, if possible -- and
@@ -1009,9 +1012,6 @@ protected:
private:
void handleChangedOperand(void *Ref, Metadata *New);
- /// Resolve a unique, unresolved node.
- void resolve();
-
/// Drop RAUW support, if any.
void dropReplaceableUses();
@@ -1188,7 +1188,8 @@ void TempMDNodeDeleter::operator()(MDNode *Node) const {
/// particular Metadata subclass.
template <class T>
class TypedMDOperandIterator
- : std::iterator<std::input_iterator_tag, T *, std::ptrdiff_t, void, T *> {
+ : public std::iterator<std::input_iterator_tag, T *, std::ptrdiff_t, void,
+ T *> {
MDNode::op_iterator I = nullptr;
public:
@@ -1302,7 +1303,13 @@ public:
if (!Use)
return;
*Use = MD;
- Use = nullptr;
+
+ if (*Use)
+ MetadataTracking::track(*Use);
+
+ Metadata *T = cast<Metadata>(this);
+ MetadataTracking::untrack(T);
+ assert(!Use && "Use is still being tracked despite being untracked!");
}
};