aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/SourceLocation.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-10-25 16:02:43 +0000
committerTed Kremenek <kremenek@apple.com>2007-10-25 16:02:43 +0000
commit19a95bcf3561ed977c48d5f2a2793b60a8c8e573 (patch)
treeafde6a4e5f253ccd8fb725a11313983715e58203 /include/clang/Basic/SourceLocation.h
parentcc326204dd97771c336b9aab3b9963ea30d69c29 (diff)
Implemented serialization of SourceLocation and SourceRange objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43343 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/SourceLocation.h')
-rw-r--r--include/clang/Basic/SourceLocation.h28
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