aboutsummaryrefslogtreecommitdiff
path: root/Basic/SourceLocation.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-11-01 22:25:41 +0000
committerTed Kremenek <kremenek@apple.com>2007-11-01 22:25:41 +0000
commitbeb7713c6102687f7e49e27b8228e84a69d8f6c6 (patch)
tree76465c0d14bb51f62009af9a60417cddcfed11db /Basic/SourceLocation.cpp
parentb210bd0404f84b99259c9987d347a44d3c202238 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43625 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Basic/SourceLocation.cpp')
-rw-r--r--Basic/SourceLocation.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/Basic/SourceLocation.cpp b/Basic/SourceLocation.cpp
index e39f6b7f64..75b4a99d45 100644
--- a/Basic/SourceLocation.cpp
+++ b/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);
+}