[PATCH] This change-list changes clang to attach the ordinary comments if an option is specified

Dmitri Gribenko gribozavr at gmail.com
Tue Apr 9 12:17:46 PDT 2013


  This patch looks good, I have just a few style remarks.


================
Comment at: include/clang/AST/RawCommentList.h:87-88
@@ -84,3 +86,4 @@
   bool isOrdinary() const LLVM_READONLY {
-    return (Kind == RCK_OrdinaryBCPL) || (Kind == RCK_OrdinaryC);
+    return ((Kind == RCK_OrdinaryBCPL) || (Kind == RCK_OrdinaryC))
+        && !ParseAllComments;
   }
----------------
LLVM and Clang style is to leave '&&' on the previous line.

================
Comment at: include/clang/AST/RawCommentList.h:145-147
@@ -136,2 +144,5 @@
   bool IsAlmostTrailingComment : 1;
+  /// When true, ordinary comments starting with "//" and "/*" will be
+  // considered as documentation comments.
+  bool ParseAllComments : 1;
 
----------------
Please put two slashes on the second line (to turn this into a documentation comment).  Also put a blank line before this comment.

================
Comment at: include/clang/Basic/CommentOptions.h:31-32
@@ +30,4 @@
+
+  /// \brief Treat ordinary comments as doc-comments.
+  bool ParseAllComments;
+
----------------
Please spell 'documentation comments' completely.

================
Comment at: include/clang/AST/RawCommentList.h:44-45
@@ -42,3 +43,4 @@
   RawComment(const SourceManager &SourceMgr, SourceRange SR,
-             bool Merged = false);
+             bool Merged = false,
+             bool ParseAllComments = false);
 
----------------
I think these default arguments are unused now.  If they are, please remove them.

================
Comment at: docs/UsersManual.rst:1318
@@ +1317,3 @@
+
+Clang parses doxygen and non-doxygen style documentation comments and attaches
+them to the appropriate declaration nodes. By default, it only parses doxygen
----------------
Please spell Doxygen with a capital 'D'.

================
Comment at: docs/UsersManual.rst:1325-1326
@@ +1324,3 @@
+
+  Clang will parse all documentation comments including doxygen and non-doxygen
+  style ones (Those starting with "//" and "/*").
----------------
Maybe:

    Clang will parse all comments as documentation comments (including ordinary comments starting with `//` and `/*`).


http://llvm-reviews.chandlerc.com/D614



More information about the cfe-commits mailing list