/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Tooling/Syntax/TokenBufferTokenManager.cpp
Line | Count | Source |
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 | | |
11 | | namespace clang { |
12 | | namespace syntax { |
13 | | constexpr llvm::StringLiteral syntax::TokenBufferTokenManager::Kind; |
14 | | |
15 | | std::pair<FileID, ArrayRef<syntax::Token>> |
16 | | syntax::TokenBufferTokenManager::lexBuffer( |
17 | 1.70k | std::unique_ptr<llvm::MemoryBuffer> Input) { |
18 | 1.70k | auto FID = SM.createFileID(std::move(Input)); |
19 | 1.70k | auto It = ExtraTokens.try_emplace(FID, tokenize(FID, SM, LangOpts)); |
20 | 1.70k | assert(It.second && "duplicate FileID"); |
21 | 1.70k | return {FID, It.first->second}; |
22 | 1.70k | } |
23 | | |
24 | | } // namespace syntax |
25 | | } // namespace clang |