From 5e2eb261af52fbf265311f3a71209c505cf20075 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 1 Nov 2007 22:25:41 +0000 Subject: 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 --- clang/Basic/SourceLocation.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'clang/Basic/SourceLocation.cpp') 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::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::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); +} -- cgit v1.2.3