Updated backpatching during object deserialization to support "smart"
pointers that employ unused bits in a pointer to store extra data.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43373 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Bitcode/Reader/Deserialize.cpp b/lib/Bitcode/Reader/Deserialize.cpp
index 3e16027..66df46e 100644
--- a/lib/Bitcode/Reader/Deserialize.cpp
+++ b/lib/Bitcode/Reader/Deserialize.cpp
@@ -126,7 +126,9 @@
assert (Entry.Ptr && "No pointer found for backpatch.");
for (BPatchNode* N = Entry.Head; N != NULL; N = N->Next)
- N->PtrRef = Entry.Ptr;
+ // Bitwise-OR in the pointer to support "smart" pointers that use
+ // unused bits to store extra data.
+ N->PtrRef |= reinterpret_cast<uintptr_t>(Entry.Ptr);
Entry.Head = NULL;
}