Ted Kremenek | 9511ec8 | 2007-10-25 16:02:43 +0000 | [diff] [blame] | 1 | //==--- SourceLocation.cpp - Compact identifier for Source Files -*- C++ -*-==// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by Ted Kremenek and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines serialization methods for the SourceLocation class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "clang/Basic/SourceLocation.h" |
| 15 | #include "llvm/Bitcode/Serialize.h" |
| 16 | #include "llvm/Bitcode/Deserialize.h" |
| 17 | |
Ted Kremenek | 9511ec8 | 2007-10-25 16:02:43 +0000 | [diff] [blame] | 18 | using namespace clang; |
| 19 | |
Ted Kremenek | 414bf8f | 2007-11-01 22:25:41 +0000 | [diff] [blame^] | 20 | void SourceLocation::Emit(llvm::Serializer& S) const { |
| 21 | S.EmitInt(getRawEncoding()); |
Ted Kremenek | 9511ec8 | 2007-10-25 16:02:43 +0000 | [diff] [blame] | 22 | } |
| 23 | |
Ted Kremenek | 414bf8f | 2007-11-01 22:25:41 +0000 | [diff] [blame^] | 24 | SourceLocation SourceLocation::ReadVal(llvm::Deserializer& D) { |
Ted Kremenek | 9511ec8 | 2007-10-25 16:02:43 +0000 | [diff] [blame] | 25 | return SourceLocation::getFromRawEncoding(D.ReadInt()); |
| 26 | } |
Ted Kremenek | 414bf8f | 2007-11-01 22:25:41 +0000 | [diff] [blame^] | 27 | |
| 28 | void SourceRange::Emit(llvm::Serializer& S) const { |
| 29 | B.Emit(S); |
| 30 | E.Emit(S); |
| 31 | } |
| 32 | |
| 33 | SourceRange SourceRange::ReadVal(llvm::Deserializer& D) { |
| 34 | SourceLocation A = SourceLocation::ReadVal(D); |
| 35 | SourceLocation B = SourceLocation::ReadVal(D); |
| 36 | return SourceRange(A,B); |
| 37 | } |