aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Bitcode/Deserialize.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-11-06 22:21:14 +0000
committerTed Kremenek <kremenek@apple.com>2007-11-06 22:21:14 +0000
commitb12a82dbf4653b25d6bf3f55eb617339e9086dde (patch)
tree00cc59d7eec511ca7fd232bb8c3a90fe79cc0fff /include/llvm/Bitcode/Deserialize.h
parent373a733be031f52cebbbcdb15ab5997d9b5f9f17 (diff)
Augmented ReadPtr and ReadOwnedPtr to control whether or not a pointer is allowed to be backpatched
or can be registered with the deserializer to backpatch other pointers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43783 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Bitcode/Deserialize.h')
-rw-r--r--include/llvm/Bitcode/Deserialize.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/include/llvm/Bitcode/Deserialize.h b/include/llvm/Bitcode/Deserialize.h
index 283e6035c7..9fdbc8cd96 100644
--- a/include/llvm/Bitcode/Deserialize.h
+++ b/include/llvm/Bitcode/Deserialize.h
@@ -114,33 +114,36 @@ public:
void ReadCStr(std::vector<char>& buff, bool isNullTerm=false);
template <typename T>
- inline T* ReadOwnedPtr() {
+ inline T* ReadOwnedPtr(bool AutoRegister = true) {
unsigned PtrId = ReadInt();
if (PtrId == 0)
return NULL;
T* x = SerializeTrait<T>::Materialize(*this);
- RegisterPtr(PtrId,x);
+
+ if (AutoRegister)
+ RegisterPtr(PtrId,x);
+
return x;
}
template <typename T>
- inline void ReadOwnedPtr(T*& Ptr) {
- Ptr = ReadOwnedPtr<T>();
+ inline void ReadOwnedPtr(T*& Ptr, bool AutoRegister = true) {
+ Ptr = ReadOwnedPtr<T>(AutoRegister);
}
template <typename T>
- void ReadPtr(T*& PtrRef) {
- ReadUIntPtr(reinterpret_cast<uintptr_t&>(PtrRef));
+ void ReadPtr(T*& PtrRef, bool AllowBackpatch = true) {
+ ReadUIntPtr(reinterpret_cast<uintptr_t&>(PtrRef), AllowBackpatch);
}
template <typename T>
- void ReadPtr(const T*& PtrRef) {
- ReadPtr(const_cast<T*&>(PtrRef));
+ void ReadPtr(const T*& PtrRef, bool AllowBackpatch = true) {
+ ReadPtr(const_cast<T*&>(PtrRef), AllowBackpatch);
}
- void ReadUIntPtr(uintptr_t& PtrRef);
+ void ReadUIntPtr(uintptr_t& PtrRef, bool AllowBackpatch = true);
template <typename T>
T& ReadRef() {