From bac69d33d013a86277cf2acb9809819e1623c732 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Fri, 22 Jul 2016 19:56:05 +0000 Subject: [msf] Create LLVMDebugInfoMsf This provides a better layering of responsibilities among different aspects of PDB writing code. Some of the MSF related code was contained in CodeView, and some was in PDB prior to this. Further, we were often saying PDB when we meant MSF, and the two are actually independent of each other since in theory you can have other types of data besides PDB data in an MSF. So, this patch separates the MSF specific code into its own library, with no dependencies on anything else, and DebugInfoCodeView and DebugInfoPDB take dependencies on DebugInfoMsf. llvm-svn: 276458 --- llvm/lib/DebugInfo/CodeView/ByteStream.cpp | 79 ------------------------------ 1 file changed, 79 deletions(-) delete mode 100644 llvm/lib/DebugInfo/CodeView/ByteStream.cpp (limited to 'llvm/lib/DebugInfo/CodeView/ByteStream.cpp') diff --git a/llvm/lib/DebugInfo/CodeView/ByteStream.cpp b/llvm/lib/DebugInfo/CodeView/ByteStream.cpp deleted file mode 100644 index 2c43bc6958d..00000000000 --- a/llvm/lib/DebugInfo/CodeView/ByteStream.cpp +++ /dev/null @@ -1,79 +0,0 @@ -//===- ByteStream.cpp - Reads stream data from a byte sequence ------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "llvm/DebugInfo/CodeView/ByteStream.h" -#include "llvm/DebugInfo/CodeView/CodeViewError.h" -#include "llvm/DebugInfo/CodeView/StreamReader.h" -#include - -using namespace llvm; -using namespace llvm::codeview; - -static Error writeBytes(uint32_t Offset, ArrayRef Src, - ArrayRef Dest) { - return make_error(cv_error_code::operation_unsupported, - "ByteStream is immutable."); -} - -static Error writeBytes(uint32_t Offset, ArrayRef Src, - MutableArrayRef Dest) { - if (Dest.size() < Src.size()) - return make_error(cv_error_code::insufficient_buffer); - if (Offset > Src.size() - Dest.size()) - return make_error(cv_error_code::insufficient_buffer); - - ::memcpy(Dest.data() + Offset, Src.data(), Src.size()); - return Error::success(); -} - -template -Error ByteStream::readBytes(uint32_t Offset, uint32_t Size, - ArrayRef &Buffer) const { - if (Offset > Data.size()) - return make_error(cv_error_code::insufficient_buffer); - if (Data.size() < Size + Offset) - return make_error(cv_error_code::insufficient_buffer); - Buffer = Data.slice(Offset, Size); - return Error::success(); -} - -template -Error ByteStream::readLongestContiguousChunk( - uint32_t Offset, ArrayRef &Buffer) const { - if (Offset >= Data.size()) - return make_error(cv_error_code::insufficient_buffer); - Buffer = Data.slice(Offset); - return Error::success(); -} - -template -Error ByteStream::writeBytes(uint32_t Offset, - ArrayRef Buffer) const { - return ::writeBytes(Offset, Buffer, Data); -} - -template uint32_t ByteStream::getLength() const { - return Data.size(); -} - -template Error ByteStream::commit() const { - return Error::success(); -} - -template StringRef ByteStream::str() const { - const char *CharData = reinterpret_cast(Data.data()); - return StringRef(CharData, Data.size()); -} - -namespace llvm { -namespace codeview { -template class ByteStream; -template class ByteStream; -} -} -- cgit v1.2.3