15#include "llvm/Support/MemoryBuffer.h"
34 const char *&DestPtr) {
36 AllocScratchBuffer(Len+2);
40 SourceMgr.getSLocEntry(SourceMgr.getFileID(BufferStartLoc))
48 CurBuffer[BytesUsed++] =
'\n';
51 DestPtr = CurBuffer+BytesUsed;
54 memcpy(CurBuffer+BytesUsed, Buf, Len);
62 CurBuffer[BytesUsed-1] =
'\0';
64 return BufferStartLoc.getLocWithOffset(BytesUsed-Len-1);
67void ScratchBuffer::AllocScratchBuffer(
unsigned RequestLen) {
76 std::unique_ptr<llvm::WritableMemoryBuffer> OwnBuf =
77 llvm::WritableMemoryBuffer::getNewMemBuffer(RequestLen,
79 CurBuffer = OwnBuf->getBufferStart();
80 FileID FID = SourceMgr.createFileID(std::move(OwnBuf));
81 BufferStartLoc = SourceMgr.getLocForStartOfFile(FID);
static const unsigned ScratchBufSize
Defines the SourceManager interface.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
SourceLocation getToken(const char *Buf, unsigned Len, const char *&DestPtr)
getToken - Splat the specified text into a temporary MemoryBuffer and return a SourceLocation that re...
ScratchBuffer(SourceManager &SM)
Encodes a location in the source.
This class handles loading and caching of source files into memory.
Mapping of line offsets into a source file.
The JSON file list parser is used to communicate input to InstallAPI.
nullptr
This class represents a compute construct, representing a 'Kind' of βparallelβ, 'serial',...