summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/CommentParser.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2013-01-26 00:36:14 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2013-01-26 00:36:14 +0000
commit714693059116794ba293787437b293327b38a95d (patch)
tree0987c8356b8c265024dc4bae9c689e042a091d0f /clang/lib/AST/CommentParser.cpp
parent8334af8c2a88e59860e7aef2ec44a64df402cae1 (diff)
downloadbcm5719-llvm-714693059116794ba293787437b293327b38a95d.tar.gz
bcm5719-llvm-714693059116794ba293787437b293327b38a95d.zip
Comment parsing: actually check for a block command after "\param x"
This fixes PR15068. llvm-svn: 173539
Diffstat (limited to 'clang/lib/AST/CommentParser.cpp')
-rw-r--r--clang/lib/AST/CommentParser.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/clang/lib/AST/CommentParser.cpp b/clang/lib/AST/CommentParser.cpp
index a7ba013efcc..5f45125bdce 100644
--- a/clang/lib/AST/CommentParser.cpp
+++ b/clang/lib/AST/CommentParser.cpp
@@ -329,8 +329,7 @@ BlockCommandComment *Parser::parseBlockCommand() {
}
consumeToken();
- if (Tok.is(tok::command) &&
- Traits.getCommandInfo(Tok.getCommandID())->IsBlockCommand) {
+ if (isTokBlockCommand()) {
// Block command ahead. We can't nest block commands, so pretend that this
// command has an empty argument.
ParagraphComment *Paragraph = S.actOnParagraphComment(
@@ -362,10 +361,28 @@ BlockCommandComment *Parser::parseBlockCommand() {
Retokenizer.putBackLeftoverTokens();
}
- BlockContentComment *Block = parseParagraphOrBlockCommand();
- // Since we have checked for a block command, we should have parsed a
- // paragraph.
- ParagraphComment *Paragraph = cast<ParagraphComment>(Block);
+ // If there's a block command ahead, we will attach an empty paragraph to
+ // this command.
+ bool EmptyParagraph = false;
+ if (isTokBlockCommand())
+ EmptyParagraph = true;
+ else if (Tok.is(tok::newline)) {
+ Token PrevTok = Tok;
+ consumeToken();
+ EmptyParagraph = isTokBlockCommand();
+ putBack(PrevTok);
+ }
+
+ ParagraphComment *Paragraph;
+ if (EmptyParagraph)
+ Paragraph = S.actOnParagraphComment(ArrayRef<InlineContentComment *>());
+ else {
+ BlockContentComment *Block = parseParagraphOrBlockCommand();
+ // Since we have checked for a block command, we should have parsed a
+ // paragraph.
+ Paragraph = cast<ParagraphComment>(Block);
+ }
+
if (IsParam) {
S.actOnParamCommandFinish(PC, Paragraph);
return PC;
OpenPOWER on IntegriCloud