Please also mention this new command line option in the documentation.  
http://clang.llvm.org/docs/UsersManual.html should be a good place.  Add a new 
section about documentation comments if this does not fall naturally into 
existing sections.


================
Comment at: test/Index/parse-all-comments.c:35
@@ +34,3 @@
+// RUN: FileCheck %s < %t/out.c-index-direct
+
+// CHECK: parse-all-comments.c:7:6: FunctionDecl=notdoxy1:{{.*}} notdoxy1 
NOT_DOXYGEN
----------------
Amin Shali wrote:
> For some reason the out.c-index-pch does not have the I expected.
> Running the follwing check fails after this RUN:
> // RUN: c-index-test -test-load-tu %t/out.pch all > %t/out.c-index-pch
> 
> Can you help me with that? Is it necessary to run the check on 
> out.c-index-pch or out.c-index-direct good enough?
> 
Yes, pch usecase is important. This error is caused by missing 
serialization/deserialization code in `lib/Serialization/ASTReader.cpp` and 
`lib/Serialization/ASTWriter.cpp`.

================
Comment at: test/Index/parse-all-comments.c:6-7
@@ +5,4 @@
+
+// Not a Doxygen comment.  notdoxy1 NOT_DOXYGEN
+void notdoxy1(void);
+
----------------
Please add a test that consecutive '//' comments are merged.  See isdoxy20 in 
the original test for an idea.

================
Comment at: include/clang/AST/RawCommentList.h:92
@@ -89,3 +91,3 @@
   bool isDocumentation() const LLVM_READONLY {
-    return !isInvalid() && !isOrdinary();
+    return !isInvalid() && (!isOrdinary() || TreatOrdinaryCommentAsDocComment);
   }
----------------
Amin Shali wrote:
> Dmitri Gribenko wrote:
> > It would be better to change isOrdinary instead:
> > 
> >   return (Kind == RCK_OrdinaryBCPL) || (Kind == RCK_OrdinaryC) || 
> > TreatOrdinaryCommentAsDocComment;
> > 
> Wait, you mean:
>    
>    return (Kind == RCK_OrdinaryBCPL) || (Kind == RCK_OrdinaryC) || 
> !ParseAllComments;
> 
> But then it skips doxygen style comments when ParseAllComments is false.
> Besides I think it should be in isDocumentation because otherwise it will 
> fail to return the comment for a declaration because of the check at line 191 
> file: ASTContext.cpp.
> 
Yes, that line is incorrect.  The correct should be:

    return ((Kind == RCK_OrdinaryBCPL) || (Kind == RCK_OrdinaryC)) && 
!ParseAllComments;

Does this fix the issue in ASTContext?

================
Comment at: lib/AST/RawCommentList.cpp:232
@@ -230,3 +231,3 @@
   // Ordinary comments are not interesting for us.
-  if (RC.isOrdinary())
+  if (!RC.isDocumentation())
     return;
----------------
Why this change?  isOrdinary() should be the exact opposite of 
isDocumentation() (modulo invalid cases).

================
Comment at: include/clang/AST/RawCommentList.h:144
@@ -136,1 +143,3 @@
   bool IsAlmostTrailingComment : 1;
+  /// When true, ordinary comments starting with "//" will be considered as
+  /// documentation comments.
----------------
Also mention /* ... */ comments.

================
Comment at: include/clang/Basic/CommentOptions.h:31-32
@@ +30,4 @@
+
+  /// \brief Treat ordinary comments as doc-comments.
+  bool ParseAllComments;
+
----------------
Serialization/deserialization code is missing.  Grep for BlockCommandNames to 
find the relevant places.


http://llvm-reviews.chandlerc.com/D614
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to