[document parsing]: Allow multiple adjacent \return and the like
commands. Render them properly in XML output.
// rdar://14207725

llvm-svn: 184610
diff --git a/clang/tools/libclang/CXComment.cpp b/clang/tools/libclang/CXComment.cpp
index 1c127e1..b96ca1c 100644
--- a/clang/tools/libclang/CXComment.cpp
+++ b/clang/tools/libclang/CXComment.cpp
@@ -412,7 +412,7 @@
   const BlockContentComment *Brief;
   const BlockContentComment *Headerfile;
   const ParagraphComment *FirstParagraph;
-  const BlockCommandComment *Returns;
+  SmallVector<const BlockCommandComment *, 4> Returns;
   SmallVector<const ParamCommandComment *, 8> Params;
   SmallVector<const TParamCommandComment *, 4> TParams;
   SmallVector<const BlockContentComment *, 8> MiscBlocks;
@@ -420,7 +420,7 @@
 
 FullCommentParts::FullCommentParts(const FullComment *C,
                                    const CommandTraits &Traits) :
-    Brief(NULL), Headerfile(NULL), FirstParagraph(NULL), Returns(NULL) {
+    Brief(NULL), Headerfile(NULL), FirstParagraph(NULL) {
   for (Comment::child_iterator I = C->child_begin(), E = C->child_end();
        I != E; ++I) {
     const Comment *Child = *I;
@@ -452,8 +452,8 @@
         Headerfile = BCC;
         break;
       }
-      if (!Returns && Info->IsReturnsCommand) {
-        Returns = BCC;
+      if (Info->IsReturnsCommand) {
+        Returns.push_back(BCC);
         break;
       }
       MiscBlocks.push_back(BCC);
@@ -786,8 +786,12 @@
     Result << "</dl>";
   }
 
-  if (Parts.Returns)
-    visit(Parts.Returns);
+  if (Parts.Returns.size() != 0) {
+    Result << "<dl>";
+    for (unsigned i = 0, e = Parts.Returns.size(); i != e; ++i)
+      visit(Parts.Returns[i]);
+    Result << "</dl>";
+  }
 
   Result.flush();
 }
@@ -1297,9 +1301,10 @@
     Result << "</Parameters>";
   }
 
-  if (Parts.Returns) {
+  if (Parts.Returns.size() != 0) {
     Result << "<ResultDiscussion>";
-    visit(Parts.Returns);
+    for (unsigned i = 0, e = Parts.Returns.size(); i != e; ++i)
+      visit(Parts.Returns[i]);
     Result << "</ResultDiscussion>";
   }