clang 22.0.0git
TokenBufferTokenManager.cpp
Go to the documentation of this file.
1//===- TokenBufferTokenManager.cpp ----------------------------------------===//
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
10
11namespace clang {
12namespace syntax {
13std::pair<FileID, ArrayRef<syntax::Token>>
14syntax::TokenBufferTokenManager::lexBuffer(
15 std::unique_ptr<llvm::MemoryBuffer> Input) {
16 auto FID = SM.createFileID(std::move(Input));
17 auto It = ExtraTokens.try_emplace(FID, tokenize(FID, SM, LangOpts));
18 assert(It.second && "duplicate FileID");
19 return {FID, It.first->second};
20}
21
22} // namespace syntax
23} // namespace clang
#define SM(sm)
std::vector< syntax::Token > tokenize(FileID FID, const SourceManager &SM, const LangOptions &LO)
Lex the text buffer, corresponding to FID, in raw mode and record the resulting spelled tokens.
Definition Tokens.cpp:606
The JSON file list parser is used to communicate input to InstallAPI.