15#include "llvm/Support/MemoryBuffer.h"
24 : SourceMgr(
SM), CurBuffer(nullptr) {
34 const char *&DestPtr) {
36 AllocScratchBuffer(Len+2);
48 CurBuffer[BytesUsed++] =
'\n';
51 DestPtr = CurBuffer+BytesUsed;
54 memcpy(CurBuffer+BytesUsed, Buf, Len);
62 CurBuffer[BytesUsed-1] =
'\0';
67void ScratchBuffer::AllocScratchBuffer(
unsigned RequestLen) {
76 std::unique_ptr<llvm::WritableMemoryBuffer> OwnBuf =
77 llvm::WritableMemoryBuffer::getNewMemBuffer(RequestLen,
79 CurBuffer = OwnBuf->getBufferStart();
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.
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
This class handles loading and caching of source files into memory.
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
FileID createFileID(FileEntryRef SourceFile, SourceLocation IncludePos, SrcMgr::CharacteristicKind FileCharacter, int LoadedID=0, SourceLocation::UIntTy LoadedOffset=0)
Create a new FileID that represents the specified file being #included from the specified IncludePosi...
SourceLocation getLocForStartOfFile(FileID FID) const
Return the source location corresponding to the first byte of the specified file.
const SrcMgr::SLocEntry & getSLocEntry(FileID FID, bool *Invalid=nullptr) const
LineOffsetMapping SourceLineCache
A bump pointer allocated array of offsets for each source line.
const ContentCache & getContentCache() const
Mapping of line offsets into a source file.
const FileInfo & getFile() const
The JSON file list parser is used to communicate input to InstallAPI.