diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-18 22:35:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-18 22:35:47 +0000 |
commit | 046c2277dcbcc8eb89dbb5b1b8c5226b7cb81635 (patch) | |
tree | ca203780b57621d64d1316c4eda5a13622951626 /lib/Lex/Preprocessor.cpp | |
parent | 2c6b193d574e0780ff0b8450ce1fde105f4881ac (diff) |
allow the HandlerComment callback to push tokens into the
preprocessor. This could be used by an OpenMP implementation
or something. Patch by Abramo Bagnara!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93795 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r-- | lib/Lex/Preprocessor.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 26bb3a90da..586202bccf 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -583,11 +583,18 @@ void Preprocessor::RemoveCommentHandler(CommentHandler *Handler) { CommentHandlers.erase(Pos); } -void Preprocessor::HandleComment(SourceRange Comment) { +bool Preprocessor::HandleComment(Token &result, SourceRange Comment) { + bool AnyPendingTokens = false; for (std::vector<CommentHandler *>::iterator H = CommentHandlers.begin(), HEnd = CommentHandlers.end(); - H != HEnd; ++H) - (*H)->HandleComment(*this, Comment); + H != HEnd; ++H) { + if ((*H)->HandleComment(*this, Comment)) + AnyPendingTokens = true; + } + if (!AnyPendingTokens || getCommentRetentionState()) + return false; + Lex(result); + return true; } CommentHandler::~CommentHandler() { } |