llvm-project/clang/Basic/SourceLocation.cpp
Ted Kremenek 5e2eb261af 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.

llvm-svn: 43625
2007-11-01 22:25:41 +00:00

38 lines
1.1 KiB
C++

//==--- SourceLocation.cpp - Compact identifier for Source Files -*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by Ted Kremenek and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines serialization methods for the SourceLocation class.
//
//===----------------------------------------------------------------------===//
#include "clang/Basic/SourceLocation.h"
#include "llvm/Bitcode/Serialize.h"
#include "llvm/Bitcode/Deserialize.h"
using namespace clang;
void SourceLocation::Emit(llvm::Serializer& S) const {
S.EmitInt(getRawEncoding());
}
SourceLocation SourceLocation::ReadVal(llvm::Deserializer& D) {
return SourceLocation::getFromRawEncoding(D.ReadInt());
}
void SourceRange::Emit(llvm::Serializer& S) const {
B.Emit(S);
E.Emit(S);
}
SourceRange SourceRange::ReadVal(llvm::Deserializer& D) {
SourceLocation A = SourceLocation::ReadVal(D);
SourceLocation B = SourceLocation::ReadVal(D);
return SourceRange(A,B);
}