diff options
| author | Dmitri Gribenko <gribozavr@gmail.com> | 2012-07-18 23:01:58 +0000 |
|---|---|---|
| committer | Dmitri Gribenko <gribozavr@gmail.com> | 2012-07-18 23:01:58 +0000 |
| commit | e4a3997d70345d1ac277d8c77153d78fb96b3f5d (patch) | |
| tree | 5c57670ab52ad7a768bf49626b9c7d8a35b2db3a /clang/lib/AST | |
| parent | 66372684f70a3dda8ba87341eb363d78082e3b7e (diff) | |
| download | bcm5719-llvm-e4a3997d70345d1ac277d8c77153d78fb96b3f5d.tar.gz bcm5719-llvm-e4a3997d70345d1ac277d8c77153d78fb96b3f5d.zip | |
Comment parsing: don't parse whitespace before \endverbatim as a separate line of whitespace.
llvm-svn: 160464
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/CommentLexer.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/AST/CommentLexer.cpp b/clang/lib/AST/CommentLexer.cpp index 5b411ca9cc0..31468321cf4 100644 --- a/clang/lib/AST/CommentLexer.cpp +++ b/clang/lib/AST/CommentLexer.cpp @@ -201,6 +201,10 @@ const char *skipWhitespace(const char *BufferPtr, const char *BufferEnd) { return BufferEnd; } +bool isWhitespace(const char *BufferPtr, const char *BufferEnd) { + return skipWhitespace(BufferPtr, BufferEnd) == BufferEnd; +} + bool isCommandNameCharacter(char C) { return (C >= 'a' && C <= 'z') || (C >= 'A' && C <= 'Z') || @@ -429,6 +433,7 @@ void Lexer::setupAndLexVerbatimBlock(Token &T, } void Lexer::lexVerbatimBlockFirstLine(Token &T) { +again: assert(BufferPtr < CommentEnd); // FIXME: It would be better to scan the text once, finding either the block @@ -458,6 +463,11 @@ void Lexer::lexVerbatimBlockFirstLine(Token &T) { // There is some text, followed by end command. Extract text first. TextEnd = BufferPtr + Pos; NextLine = TextEnd; + // If there is only whitespace before end command, skip whitespace. + if (isWhitespace(BufferPtr, TextEnd)) { + BufferPtr = TextEnd; + goto again; + } } StringRef Text(BufferPtr, TextEnd - BufferPtr); |

