[cfe-commits] r158882 - /cfe/trunk/lib/AST/RawCommentList.cpp

Dmitri Gribenko gribozavr at gmail.com
Wed Jun 20 17:28:14 PDT 2012


Author: gribozavr
Date: Wed Jun 20 19:28:14 2012
New Revision: 158882

URL: http://llvm.org/viewvc/llvm-project?rev=158882&view=rev
Log:
RawCommentList::addComment: fix the assertion so it actually checks that new comment is after the last one (change Comments[0] to Comments.back()), and handle the case of two consecutive comments, e.g. /** *//* */.  There is already a testcase for that (but it didn't trigger the assert because the assert itself was wrong).

Modified:
    cfe/trunk/lib/AST/RawCommentList.cpp

Modified: cfe/trunk/lib/AST/RawCommentList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RawCommentList.cpp?rev=158882&r1=158881&r2=158882&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RawCommentList.cpp (original)
+++ cfe/trunk/lib/AST/RawCommentList.cpp Wed Jun 20 19:28:14 2012
@@ -159,8 +159,10 @@
     return;
 
   assert((Comments.empty() ||
+          Comments.back().getSourceRange().getEnd() ==
+              RC.getSourceRange().getBegin() ||
           SourceMgr.isBeforeInTranslationUnit(
-              Comments[0].getSourceRange().getEnd(),
+              Comments.back().getSourceRange().getEnd(),
               RC.getSourceRange().getBegin())) &&
          "comments are not coming in source order");
 





More information about the cfe-commits mailing list