blob: 75b4a99d45bb342462dc739a0f44017cd91e5738 [file] [log] [blame]
Ted Kremenek9511ec82007-10-25 16:02:43 +00001//==--- 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 Kremenek9511ec82007-10-25 16:02:43 +000018using namespace clang;
19
Ted Kremenek414bf8f2007-11-01 22:25:41 +000020void SourceLocation::Emit(llvm::Serializer& S) const {
21 S.EmitInt(getRawEncoding());
Ted Kremenek9511ec82007-10-25 16:02:43 +000022}
23
Ted Kremenek414bf8f2007-11-01 22:25:41 +000024SourceLocation SourceLocation::ReadVal(llvm::Deserializer& D) {
Ted Kremenek9511ec82007-10-25 16:02:43 +000025 return SourceLocation::getFromRawEncoding(D.ReadInt());
26}
Ted Kremenek414bf8f2007-11-01 22:25:41 +000027
28void SourceRange::Emit(llvm::Serializer& S) const {
29 B.Emit(S);
30 E.Emit(S);
31}
32
33SourceRange SourceRange::ReadVal(llvm::Deserializer& D) {
34 SourceLocation A = SourceLocation::ReadVal(D);
35 SourceLocation B = SourceLocation::ReadVal(D);
36 return SourceRange(A,B);
37}