[PATCH] D11069: Allow any comment to be a trailing comment when -fparse-all-comments is on.

Richard Smith richard at metafoo.co.uk
Thu Jul 9 16:42:26 PDT 2015


rsmith added a subscriber: rsmith.

================
Comment at: lib/AST/ASTContext.cpp:70
@@ +69,3 @@
+/// are whitespace.
+static bool OnlyWhitespaceOnLineBefore(const char *Buffer, unsigned P) {
+  // Search backwards until we see linefeed or carriage return.
----------------
Please start this with a lowercase letter.

================
Comment at: lib/AST/ASTContext.cpp:233-234
@@ -205,3 +232,4 @@
   if (Comment != RawComments.end() &&
-      (*Comment)->isDocumentation() && (*Comment)->isTrailingComment() &&
+      ((*Comment)->isParseAllComments() ||
+       ((*Comment)->isDocumentation() && (*Comment)->isTrailingComment())) &&
       (isa<FieldDecl>(D) || isa<EnumConstantDecl>(D) || isa<VarDecl>(D) ||
----------------
If the comment is a documentation comment but doesn't use the trailing comment syntax, what does your patch do? For instance:

    enum E {
      A,  /// Comment about A or B?
      B
    };

The comment is recognized and attached to B outside parse-all-comments mode, so it should presumably mean the same thing in parse-all-comments mode, as broken as that is.


http://reviews.llvm.org/D11069







More information about the cfe-commits mailing list