clang 20.0.0git
|
Collects tokens for the main file while running the frontend action. More...
#include "clang/Tooling/Syntax/Tokens.h"
Public Member Functions | |
TokenCollector (Preprocessor &P) | |
Adds the hooks to collect the tokens. | |
TokenBuffer | consume () && |
Finalizes token collection. | |
Collects tokens for the main file while running the frontend action.
An instance of this object should be created on FrontendAction::BeginSourceFile() and the results should be consumed after FrontendAction::Execute() finishes.
TokenCollector::TokenCollector | ( | Preprocessor & | PP | ) |
Adds the hooks to collect the tokens.
Fills in the TokenBuffer by tracing the run of a preprocessor.
Should be called before the preprocessing starts, i.e. as a part of BeginSourceFile() or CreateASTConsumer().
The implementation tracks the tokens, macro expansions and directives coming from the preprocessor and:
Definition at line 683 of file Tokens.cpp.
References clang::Preprocessor::addPPCallbacks(), clang::Preprocessor::getSourceManager(), clang::Preprocessor::setTokenWatcher(), and clang::T.
TokenBuffer TokenCollector::consume | ( | ) | && |
Finalizes token collection.
Should be called after preprocessing is finished, i.e. after running Execute().
Definition at line 895 of file Tokens.cpp.