clang 19.0.0git
ScratchBuffer.h
Go to the documentation of this file.
1//===--- ScratchBuffer.h - Scratch space for forming tokens -----*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the ScratchBuffer interface.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LEX_SCRATCHBUFFER_H
14#define LLVM_CLANG_LEX_SCRATCHBUFFER_H
15
17
18namespace clang {
19 class SourceManager;
20
21/// ScratchBuffer - This class exposes a simple interface for the dynamic
22/// construction of tokens. This is used for builtin macros (e.g. __LINE__) as
23/// well as token pasting, etc.
25 SourceManager &SourceMgr;
26 char *CurBuffer;
27 SourceLocation BufferStartLoc;
28 unsigned BytesUsed;
29public:
31
32 /// getToken - Splat the specified text into a temporary MemoryBuffer and
33 /// return a SourceLocation that refers to the token. This is just like the
34 /// previous method, but returns a location that indicates the physloc of the
35 /// token.
36 SourceLocation getToken(const char *Buf, unsigned Len, const char *&DestPtr);
37
38private:
39 void AllocScratchBuffer(unsigned RequestLen);
40};
41
42} // end namespace clang
43
44#endif
#define SM(sm)
Definition: Cuda.cpp:84
Defines the clang::SourceLocation class and associated facilities.
ScratchBuffer - This class exposes a simple interface for the dynamic construction of tokens.
Definition: ScratchBuffer.h:24
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...
Encodes a location in the source.
This class handles loading and caching of source files into memory.
The JSON file list parser is used to communicate input to InstallAPI.