diff options
| author | Ted Kremenek <kremenek@apple.com> | 2007-11-01 22:25:41 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2007-11-01 22:25:41 +0000 |
| commit | 5e2eb261af52fbf265311f3a71209c505cf20075 (patch) | |
| tree | 9ead84c95e2deb286d3df3e73aca3da315632a16 /clang/Basic/SourceLocation.cpp | |
| parent | 478c6982a8068605c63ee39512b2ebd0713a2714 (diff) | |
| download | bcm5719-llvm-5e2eb261af52fbf265311f3a71209c505cf20075.tar.gz bcm5719-llvm-5e2eb261af52fbf265311f3a71209c505cf20075.zip | |
Simplified Serialization code for SourceLocation and SourceRange, and
updated it to the recently updated Serialization API.
Changed clients of SourceLocation serialization to call the
appropriate new methods.
Updated Decl serialization code to put new skeleton serialization code
in place that is much better than the older trait-specialization
approach.
llvm-svn: 43625
Diffstat (limited to 'clang/Basic/SourceLocation.cpp')
| -rw-r--r-- | clang/Basic/SourceLocation.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/clang/Basic/SourceLocation.cpp b/clang/Basic/SourceLocation.cpp index e39f6b7f644..75b4a99d45b 100644 --- a/clang/Basic/SourceLocation.cpp +++ b/clang/Basic/SourceLocation.cpp @@ -15,16 +15,23 @@ #include "llvm/Bitcode/Serialize.h" #include "llvm/Bitcode/Deserialize.h" -using llvm::Serializer; -using llvm::Deserializer; -using llvm::SerializeTrait; using namespace clang; -void SerializeTrait<SourceLocation>::Emit(Serializer& S, SourceLocation L) { - // FIXME: Add code for abbreviation. - S.EmitInt(L.getRawEncoding()); +void SourceLocation::Emit(llvm::Serializer& S) const { + S.EmitInt(getRawEncoding()); } -SourceLocation SerializeTrait<SourceLocation>::ReadVal(Deserializer& D) { +SourceLocation SourceLocation::ReadVal(llvm::Deserializer& D) { return SourceLocation::getFromRawEncoding(D.ReadInt()); } + +void SourceRange::Emit(llvm::Serializer& S) const { + B.Emit(S); + E.Emit(S); +} + +SourceRange SourceRange::ReadVal(llvm::Deserializer& D) { + SourceLocation A = SourceLocation::ReadVal(D); + SourceLocation B = SourceLocation::ReadVal(D); + return SourceRange(A,B); +} |

