Fix PR13411: Comment parsing: failed assertion on unterminated verbatim block.

The assertion was wrong in case we have a verbatim block without a closing
command.

Also add tests for closing command name in a verbatim block, since now it can
be empty in such cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160568 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/CommentParser.cpp b/lib/AST/CommentParser.cpp
index d4b9708..6b7e0ab 100644
--- a/lib/AST/CommentParser.cpp
+++ b/lib/AST/CommentParser.cpp
@@ -378,11 +378,16 @@
     Lines.push_back(Line);
   }
 
-  assert(Tok.is(tok::verbatim_block_end));
-  VB = S.actOnVerbatimBlockFinish(VB, Tok.getLocation(),
-                                  Tok.getVerbatimBlockName(),
-                                  copyArray(llvm::makeArrayRef(Lines)));
-  consumeToken();
+  if (Tok.is(tok::verbatim_block_end)) {
+    VB = S.actOnVerbatimBlockFinish(VB, Tok.getLocation(),
+                                    Tok.getVerbatimBlockName(),
+                                    copyArray(llvm::makeArrayRef(Lines)));
+    consumeToken();
+  } else {
+    // Unterminated \\verbatim block
+    VB = S.actOnVerbatimBlockFinish(VB, SourceLocation(), "",
+                                    copyArray(llvm::makeArrayRef(Lines)));
+  }
 
   return VB;
 }