<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,0)">No rush, just wanted to make sure this didn't go unnoticed.</div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">

<br style="font-family:verdana,sans-serif"><span style="font-family:verdana,sans-serif">--<br><div><b>​ΛMIN</b>SHΛLI シ</div></span></div></div>
<br><br><div class="gmail_quote">On Tue, Apr 23, 2013 at 5:21 PM, Amin Shali <span dir="ltr"><<a href="mailto:amshali@gmail.com" target="_blank">amshali@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi gribozavr,<br>
<br>
Multi-line ordinary comments with empty lines in between (starting with //) do not get merged when -fparse-all-comments option is passed.<br>
The issue is that the kind of comment is determined to be "invalid" because we do not take into account the -fparse-all-comments option. As a result if for example one has a comment like this:<br>
<br>
  // line 1<br>
  //<br>
  // line 2<br>
  int x;<br>
The only comment attached to the "x" is "// line 2", which is the issue.<br>
<br>
This patch fixes this issue. Added a test.<br>
<br>
<br>
<a href="http://llvm-reviews.chandlerc.com/D716" target="_blank">http://llvm-reviews.chandlerc.com/D716</a><br>
<br>
Files:<br>
  lib/AST/RawCommentList.cpp<br>
  test/Index/parse-all-comments.c<br>
<br>
Index: lib/AST/RawCommentList.cpp<br>
===================================================================<br>
--- lib/AST/RawCommentList.cpp<br>
+++ lib/AST/RawCommentList.cpp<br>
@@ -21,8 +21,9 @@<br>
<br>
 namespace {<br>
 /// Get comment kind and bool describing if it is a trailing comment.<br>
-std::pair<RawComment::CommentKind, bool> getCommentKind(StringRef Comment) {<br>
-  if (Comment.size() < 3 || Comment[0] != '/')<br>
+std::pair<RawComment::CommentKind, bool> getCommentKind(StringRef Comment,<br>
+                                                        bool ParseAllComment) {<br>
+  if ((Comment.size() < 3 && !ParseAllComment) || Comment[0] != '/')<br>
     return std::make_pair(RawComment::RCK_Invalid, false);<br>
<br>
   RawComment::CommentKind K;<br>
@@ -76,7 +77,7 @@<br>
<br>
   if (!Merged) {<br>
     // Guess comment kind.<br>
-    std::pair<CommentKind, bool> K = getCommentKind(RawText);<br>
+    std::pair<CommentKind, bool> K = getCommentKind(RawText, ParseAllComments);<br>
     Kind = K.first;<br>
     IsTrailingComment = K.second;<br>
<br>
Index: test/Index/parse-all-comments.c<br>
===================================================================<br>
--- test/Index/parse-all-comments.c<br>
+++ test/Index/parse-all-comments.c<br>
@@ -28,6 +28,11 @@<br>
 /** But there are other blocks that are part of the comment, too.  IS_DOXYGEN_END */<br>
 void multi_line_comment_plus_ordinary(int);<br>
<br>
+// MULTILINE COMMENT<br>
+//<br>
+// WITH EMPTY LINE<br>
+void multi_line_comment_empty_line(int);<br>
+<br>
 #endif<br>
<br>
 // RUN: rm -rf %t<br>
@@ -54,3 +59,4 @@<br>
 // CHECK: parse-all-comments.c:19:6: FunctionDecl=isdoxy5:{{.*}} isdoxy5 IS_DOXYGEN_SINGLE<br>
 // CHECK: parse-all-comments.c:22:6: FunctionDecl=isdoxy6:{{.*}} isdoxy6 IS_DOXYGEN_SINGLE<br>
 // CHECK: parse-all-comments.c:29:6: FunctionDecl=multi_line_comment_plus_ordinary:{{.*}} BLOCK_ORDINARY_COMMENT {{.*}} ORDINARY COMMENT {{.*}} IS_DOXYGEN_START {{.*}} IS_DOXYGEN_END<br>
+// CHECK: parse-all-comments.c:34:6: FunctionDecl=multi_line_comment_empty_line:{{.*}} MULTILINE COMMENT{{.*}}\n{{.*}}\n{{.*}} WITH EMPTY LINE<br>
</blockquote></div><br></div>