diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2012-06-27 01:17:34 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2012-06-27 01:17:34 +0000 |
commit | 99e0942cd9c6ae53f5b4fe7ac5c8a4f5ec4c6427 (patch) | |
tree | 7ff1086ebfc99bee06818b2cc6a2b9e3dd4b39ea /clang/lib/AST/CommentBriefParser.cpp | |
parent | 9036459167f63ac6c4d7eed1065ae1b4ac9b0385 (diff) | |
download | bcm5719-llvm-99e0942cd9c6ae53f5b4fe7ac5c8a4f5ec4c6427.tar.gz bcm5719-llvm-99e0942cd9c6ae53f5b4fe7ac5c8a4f5ec4c6427.zip |
Simplify logic in BriefParser::Parse(), per Jordan's comment.
llvm-svn: 159247
Diffstat (limited to 'clang/lib/AST/CommentBriefParser.cpp')
-rw-r--r-- | clang/lib/AST/CommentBriefParser.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/clang/lib/AST/CommentBriefParser.cpp b/clang/lib/AST/CommentBriefParser.cpp index 528fd2606fe..2f67602b74f 100644 --- a/clang/lib/AST/CommentBriefParser.cpp +++ b/clang/lib/AST/CommentBriefParser.cpp @@ -13,33 +13,29 @@ namespace clang { namespace comments { std::string BriefParser::Parse() { - std::string FirstParagraph; - std::string Brief; + std::string Paragraph; bool InFirstParagraph = true; bool InBrief = false; bool BriefDone = false; while (Tok.isNot(tok::eof)) { if (Tok.is(tok::text)) { - if (InFirstParagraph) - FirstParagraph += Tok.getText(); - if (InBrief) - Brief += Tok.getText(); + if (InFirstParagraph || InBrief) + Paragraph += Tok.getText(); ConsumeToken(); continue; } if (!BriefDone && Tok.is(tok::command) && Tok.getCommandName() == "brief") { + Paragraph.clear(); InBrief = true; ConsumeToken(); continue; } if (Tok.is(tok::newline)) { - if (InFirstParagraph) - FirstParagraph += '\n'; - if (InBrief) - Brief += '\n'; + if (InFirstParagraph || InBrief) + Paragraph += '\n'; ConsumeToken(); if (Tok.is(tok::newline)) { @@ -58,10 +54,7 @@ std::string BriefParser::Parse() { ConsumeToken(); } - if (Brief.size() > 0) - return Brief; - - return FirstParagraph; + return Paragraph; } BriefParser::BriefParser(Lexer &L) : L(L) |