CommentBriefParser: use \returns if we can't find the \brief or just a plain
paragraph.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160550 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/CommentBriefParser.cpp b/lib/AST/CommentBriefParser.cpp
index a6bf33e..7b7e8d5 100644
--- a/lib/AST/CommentBriefParser.cpp
+++ b/lib/AST/CommentBriefParser.cpp
@@ -53,14 +53,18 @@
 } // unnamed namespace
 
 std::string BriefParser::Parse() {
-  std::string Paragraph;
+  std::string FirstParagraphOrBrief;
+  std::string ReturnsParagraph;
   bool InFirstParagraph = true;
   bool InBrief = false;
+  bool InReturns = false;
 
   while (Tok.isNot(tok::eof)) {
     if (Tok.is(tok::text)) {
       if (InFirstParagraph || InBrief)
-        Paragraph += Tok.getText();
+        FirstParagraphOrBrief += Tok.getText();
+      else if (InReturns)
+        ReturnsParagraph += Tok.getText();
       ConsumeToken();
       continue;
     }
@@ -68,11 +72,15 @@
     if (Tok.is(tok::command)) {
       StringRef Name = Tok.getCommandName();
       if (Name == "brief" || Name == "short") {
-        Paragraph.clear();
+        FirstParagraphOrBrief.clear();
         InBrief = true;
         ConsumeToken();
         continue;
       }
+      if (Name == "result" || Name == "return" || Name == "returns") {
+        InReturns = true;
+        ReturnsParagraph += "Returns ";
+      }
       // Block commands implicitly start a new paragraph.
       if (isBlockCommand(Name)) {
         // We found an implicit paragraph end.
@@ -84,13 +92,16 @@
 
     if (Tok.is(tok::newline)) {
       if (InFirstParagraph || InBrief)
-        Paragraph += ' ';
+        FirstParagraphOrBrief += ' ';
+      else if (InReturns)
+        ReturnsParagraph += ' ';
       ConsumeToken();
 
       if (Tok.is(tok::newline)) {
         ConsumeToken();
         // We found a paragraph end.
         InFirstParagraph = false;
+        InReturns = false;
         if (InBrief)
           break;
       }
@@ -101,8 +112,12 @@
     ConsumeToken();
   }
 
-  cleanupBrief(Paragraph);
-  return Paragraph;
+  cleanupBrief(FirstParagraphOrBrief);
+  if (!FirstParagraphOrBrief.empty())
+    return FirstParagraphOrBrief;
+
+  cleanupBrief(ReturnsParagraph);
+  return ReturnsParagraph;
 }
 
 BriefParser::BriefParser(Lexer &L) : L(L)