1 //===--- ScratchBuffer.h - Scratch space for forming tokens -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the ScratchBuffer interface.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_LEX_SCRATCHBUFFER_H
15 #define LLVM_CLANG_LEX_SCRATCHBUFFER_H
17 #include "clang/Basic/SourceLocation.h"
22 /// ScratchBuffer - This class exposes a simple interface for the dynamic
23 /// construction of tokens. This is used for builtin macros (e.g. __LINE__) as
24 /// well as token pasting, etc.
26 SourceManager &SourceMgr;
28 SourceLocation BufferStartLoc;
31 ScratchBuffer(SourceManager &SM);
33 /// getToken - Splat the specified text into a temporary MemoryBuffer and
34 /// return a SourceLocation that refers to the token. This is just like the
35 /// previous method, but returns a location that indicates the physloc of the
37 SourceLocation getToken(const char *Buf, unsigned Len, const char *&DestPtr);
40 void AllocScratchBuffer(unsigned RequestLen);
43 } // end namespace clang