diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-10-25 00:10:21 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-10-25 00:10:21 +0000 |
commit | fe2a0123389adf0f2f66c413570d2daabdb5539d (patch) | |
tree | 43b79768756f6e621a013424fb535c458a85f16c /lib/Bitcode/Writer | |
parent | 8eadd5a6db79da067c773d1bd1cc13edc07788cc (diff) | |
download | external_llvm-fe2a0123389adf0f2f66c413570d2daabdb5539d.zip external_llvm-fe2a0123389adf0f2f66c413570d2daabdb5539d.tar.gz external_llvm-fe2a0123389adf0f2f66c413570d2daabdb5539d.tar.bz2 |
Implemented prototype serialization of pointers, including support
for backpatching.
Added Deserialize::ReadVal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Writer')
-rw-r--r-- | lib/Bitcode/Writer/Serialize.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Bitcode/Writer/Serialize.cpp b/lib/Bitcode/Writer/Serialize.cpp index 7293933..fbe1d10 100644 --- a/lib/Bitcode/Writer/Serialize.cpp +++ b/lib/Bitcode/Writer/Serialize.cpp @@ -57,6 +57,17 @@ void Serializer::EmitCStr(const char* s) { EmitCStr(s,s+strlen(s)); } +unsigned Serializer::getPtrId(void* ptr) { + MapTy::iterator I = PtrMap.find(ptr); + + if (I == PtrMap.end()) { + unsigned id = PtrMap.size(); + PtrMap[ptr] = id; + return id; + } + else return I->second; +} + #define INT_EMIT(TYPE)\ void SerializeTrait<TYPE>::Emit(Serializer&S, TYPE X) { S.EmitInt(X); } @@ -65,4 +76,3 @@ INT_EMIT(unsigned char) INT_EMIT(unsigned short) INT_EMIT(unsigned int) INT_EMIT(unsigned long) -INT_EMIT(unsigned long long) |