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 | beb7713c6102687f7e49e27b8228e84a69d8f6c6 (patch) | |
tree | 76465c0d14bb51f62009af9a60417cddcfed11db /include/clang/Basic/SourceLocation.h | |
parent | b210bd0404f84b99259c9987d347a44d3c202238 (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 'include/clang/Basic/SourceLocation.h')
-rw-r--r-- | include/clang/Basic/SourceLocation.h | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index 31cbfa5085..7e64e3ebbf 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -148,6 +148,12 @@ public: X.ID = Encoding; return X; } + + /// Emit - Emit this SourceLocation object to Bitcode. + void Emit(llvm::Serializer& S) const; + + /// ReadVal - Read a SourceLocation object from Bitcode. + static SourceLocation ReadVal(llvm::Deserializer& D); }; inline bool operator==(const SourceLocation &LHS, const SourceLocation &RHS) { @@ -174,35 +180,14 @@ public: void setEnd(SourceLocation e) { E = e; } bool isValid() const { return B.isValid() && E.isValid(); } -}; - -} // end namespace clang - -//===----------------------------------------------------------------------===// -// Serialization of SourceLocations and SourceRanges. -//===----------------------------------------------------------------------===// - -namespace llvm { -template<> struct SerializeTrait<clang::SourceLocation> { - static void Emit(Serializer& S, clang::SourceLocation L); - static clang::SourceLocation ReadVal(Deserializer& D); -}; + /// Emit - Emit this SourceRange object to Bitcode. + void Emit(llvm::Serializer& S) const; -template<> struct SerializeTrait<clang::SourceRange> { - static inline void Emit(Serializer& S, clang::SourceRange R) { - SerializeTrait<clang::SourceLocation>::Emit(S,R.getBegin()); - SerializeTrait<clang::SourceLocation>::Emit(S,R.getEnd()); - } - - static inline clang::SourceRange ReadVal(Deserializer& D) { - using clang::SourceLocation; - SourceLocation L = SerializeTrait<SourceLocation>::ReadVal(D); - SourceLocation R = SerializeTrait<SourceLocation>::ReadVal(D); - return clang::SourceRange(L,R); - } + /// ReadVal - Read a SourceRange object from Bitcode. + static SourceRange ReadVal(llvm::Deserializer& D); }; -} // end namespace llvm +} // end namespace clang #endif |