diff options
Diffstat (limited to 'include/clang/Lex/Preprocessor.h')
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index 7ce1aad36d12a..3efe914daaeef 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -47,6 +47,7 @@ class ExternalPreprocessorSource; class FileManager; class FileEntry; class HeaderSearch; +class MemoryBufferCache; class PragmaNamespace; class PragmaHandler; class CommentHandler; @@ -102,6 +103,7 @@ class Preprocessor { const TargetInfo *AuxTarget; FileManager &FileMgr; SourceManager &SourceMgr; + MemoryBufferCache &PCMCache; std::unique_ptr<ScratchBuffer> ScratchBuf; HeaderSearch &HeaderInfo; ModuleLoader &TheModuleLoader; @@ -652,6 +654,7 @@ class Preprocessor { public: Preprocessor(std::shared_ptr<PreprocessorOptions> PPOpts, DiagnosticsEngine &diags, LangOptions &opts, SourceManager &SM, + MemoryBufferCache &PCMCache, HeaderSearch &Headers, ModuleLoader &TheModuleLoader, IdentifierInfoLookup *IILookup = nullptr, bool OwnsHeaderSearch = false, @@ -691,6 +694,7 @@ public: const TargetInfo *getAuxTargetInfo() const { return AuxTarget; } FileManager &getFileManager() const { return FileMgr; } SourceManager &getSourceManager() const { return SourceMgr; } + MemoryBufferCache &getPCMCache() const { return PCMCache; } HeaderSearch &getHeaderSearchInfo() const { return HeaderInfo; } IdentifierTable &getIdentifierTable() { return Identifiers; } @@ -1077,6 +1081,24 @@ public: /// \brief Disable the last EnableBacktrackAtThisPos call. void CommitBacktrackedTokens(); + struct CachedTokensRange { + CachedTokensTy::size_type Begin, End; + }; + +private: + /// \brief A range of cached tokens that should be erased after lexing + /// when backtracking requires the erasure of such cached tokens. + Optional<CachedTokensRange> CachedTokenRangeToErase; + +public: + /// \brief Returns the range of cached tokens that were lexed since + /// EnableBacktrackAtThisPos() was previously called. + CachedTokensRange LastCachedTokenRange(); + + /// \brief Erase the range of cached tokens that were lexed since + /// EnableBacktrackAtThisPos() was previously called. + void EraseCachedTokens(CachedTokensRange TokenRange); + /// \brief Make Preprocessor re-lex the tokens that were lexed since /// EnableBacktrackAtThisPos() was previously called. void Backtrack(); |