clang
15.0.0git
include
clang
Lex
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
16
#include "
clang/Basic/SourceLocation.h
"
17
18
namespace
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.
24
class
ScratchBuffer
{
25
SourceManager
&SourceMgr;
26
char
*CurBuffer;
27
SourceLocation
BufferStartLoc;
28
unsigned
BytesUsed;
29
public
:
30
ScratchBuffer
(
SourceManager
&
SM
);
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
38
private
:
39
void
AllocScratchBuffer(
unsigned
RequestLen);
40
};
41
42
}
// end namespace clang
43
44
#endif
clang::SourceLocation
Encodes a location in the source.
Definition:
SourceLocation.h:86
clang::SourceManager
This class handles loading and caching of source files into memory.
Definition:
SourceManager.h:627
SourceLocation.h
clang::ScratchBuffer
ScratchBuffer - This class exposes a simple interface for the dynamic construction of tokens.
Definition:
ScratchBuffer.h:24
clang::ScratchBuffer::getToken
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...
Definition:
ScratchBuffer.cpp:33
clang
Definition:
CalledOnceCheck.h:17
clang::ScratchBuffer::ScratchBuffer
ScratchBuffer(SourceManager &SM)
Definition:
ScratchBuffer.cpp:23
SM
#define SM(sm)
Definition:
Cuda.cpp:81
Generated on Mon May 23 2022 10:54:27 for clang by
1.8.17