diff options
author | Axel Naumann <Axel.Naumann@cern.ch> | 2012-03-16 10:40:17 +0000 |
---|---|---|
committer | Axel Naumann <Axel.Naumann@cern.ch> | 2012-03-16 10:40:17 +0000 |
commit | e55329d6834647ba0e06f8a319e5d84c77310035 (patch) | |
tree | 0c6e357ffd543707ccfbc659b7657a74ab64d445 /include/clang/Lex/Preprocessor.h | |
parent | c5d3e80c64af9604ad798282cc6861f9cd2afc52 (diff) |
From Vassil Vassilev:
Enable incremental parsing by the Preprocessor,
where more code can be provided after an EOF.
It mainly prevents the tearing down of the topmost lexer.
To be used like this:
PP.enableIncrementalProcessing();
while (getMoreSource()) {
while (Parser.ParseTopLevelDecl(ADecl)) {...}
}
PP.enableIncrementalProcessing(false);
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152914 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex/Preprocessor.h')
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index 508c168f99..2abf74ed0a 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -148,6 +148,10 @@ class Preprocessor : public RefCountedBase<Preprocessor> { /// with this preprocessor. std::vector<CommentHandler *> CommentHandlers; + /// \brief True if we want to ignore EOF token and continue later on (thus + /// avoid tearing the Lexer and etc. down). + bool IncrementalProcessing; + /// \brief The code-completion handler. CodeCompletionHandler *CodeComplete; @@ -344,7 +348,8 @@ public: ModuleLoader &TheModuleLoader, IdentifierInfoLookup *IILookup = 0, bool OwnsHeaderSearch = false, - bool DelayInitialization = false); + bool DelayInitialization = false, + bool IncrProcessing = false); ~Preprocessor(); @@ -691,6 +696,14 @@ public: /// \brief Recompute the current lexer kind based on the CurLexer/CurPTHLexer/ /// CurTokenLexer pointers. void recomputeCurLexerKind(); + + /// \brief Returns true if incremental processing is enabled + bool isIncrementalProcessingEnabled() const { return IncrementalProcessing; } + + /// \brief Enables the incremental processing + void enableIncrementalProcessing(bool value = true) { + IncrementalProcessing = value; + } /// \brief Specify the point at which code-completion will be performed. /// |