clang: lib/Tooling/Syntax/TokenBufferTokenManager.cpp Source File (original) (raw)

Go to the documentation of this file.

1

2

3

4

5

6

7

8

10

12namespace syntax {

13constexpr llvm::StringLiteral syntax::TokenBufferTokenManager::Kind;

14

15std::pair<FileID, ArrayRefsyntax::Token>

16syntax::TokenBufferTokenManager::lexBuffer(

17 std::unique_ptrllvm::MemoryBuffer Input) {

18 auto FID = SM.createFileID(std::move(Input));

19 auto It = ExtraTokens.try_emplace(FID, tokenize(FID, SM, LangOpts));

20 assert(It.second && "duplicate FileID");

21 return {FID, It.first->second};

22}

23

24}

25}

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.

The JSON file list parser is used to communicate input to InstallAPI.