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
9#include "clang/Tooling/Syntax/TokenBufferTokenManager.h"
10
11namespace clang {
12namespace syntax {
13constexpr llvm::StringLiteral syntax::TokenBufferTokenManager::Kind;
14
15std::pair<FileID, ArrayRef<syntax::Token>>
16syntax::TokenBufferTokenManager::lexBuffer(
17 std::unique_ptr<llvm::MemoryBuffer> Input) {
18 auto FID = SM.createFileID(Buffer: std::move(Input));
19 auto It = ExtraTokens.try_emplace(Key: FID, Args: tokenize(FID, SM, LO: LangOpts));
20 assert(It.second && "duplicate FileID");
21 return {FID, It.first->second};
22}
23
24} // namespace syntax
25} // namespace clang
26

source code of clang/lib/Tooling/Syntax/TokenBufferTokenManager.cpp