diff options
Diffstat (limited to 'include/clang/Basic/SourceLocation.h')
-rw-r--r-- | include/clang/Basic/SourceLocation.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index f5cad5cea4..20c83bf5b2 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -15,6 +15,7 @@ #define LLVM_CLANG_SOURCELOCATION_H #include <cassert> +#include "llvm/Bitcode/Serialization.h" namespace clang { @@ -177,4 +178,31 @@ public: } // 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); +}; + +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); + } +}; + +} // end namespace llvm + #endif |