Initial commit of LLVM 3.4

This commit is contained in:
Pascal Junod
2014-01-07 11:45:01 +01:00
parent 569cee53d0
commit 0c32ada97e
10493 changed files with 713743 additions and 208975 deletions
+29
View File
@@ -0,0 +1,29 @@
//===- lib/Support/StringRefMemoryObject.cpp --------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Support/StringRefMemoryObject.h"
using namespace llvm;
int StringRefMemoryObject::readByte(uint64_t Addr, uint8_t *Byte) const {
if (Addr >= Base + getExtent() || Addr < Base)
return -1;
*Byte = Bytes[Addr - Base];
return 0;
}
int StringRefMemoryObject::readBytes(uint64_t Addr,
uint64_t Size,
uint8_t *Buf) const {
uint64_t Offset = Addr - Base;
if (Addr >= Base + getExtent() || Offset + Size > getExtent() || Addr < Base)
return -1;
memcpy(Buf, Bytes.data() + Offset, Size);
return 0;
}