aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CAS/ObjectStore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CAS/ObjectStore.cpp')
-rw-r--r--llvm/lib/CAS/ObjectStore.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CAS/ObjectStore.cpp b/llvm/lib/CAS/ObjectStore.cpp
index 3110577..c3f7a0c 100644
--- a/llvm/lib/CAS/ObjectStore.cpp
+++ b/llvm/lib/CAS/ObjectStore.cpp
@@ -213,10 +213,13 @@ Expected<ObjectRef> ObjectStore::importObject(ObjectStore &Upstream,
// Remove the current node and its IDs from the stack.
PrimaryRefStack.truncate(PrimaryRefStack.size() - Cur.RefsCount);
- CursorStack.pop_back();
+ // Push new node into created objects.
PrimaryRefStack.push_back(*NewNode);
CreatedObjects.try_emplace(Cur.Ref, *NewNode);
+
+ // Pop the cursor in the end after all uses.
+ CursorStack.pop_back();
continue;
}