[PATCH] D11069: Allow any comment to be a trailing comment when -fparse-all-comments is on.
Luke Zarko
zarko at google.com
Fri Jul 10 12:31:24 PDT 2015
zarko added inline comments.
================
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) ||
----------------
rsmith wrote:
> 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.
As the patch was written, the documentation would get attached to both A and B. I've changed strategies and now try to guess whether an ordinary comment is trailing or not (and whether that should be merged); behavior for cases like the one you've indicated is documented and checked in parse-all-comments.c.
http://reviews.llvm.org/D11069
More information about the cfe-commits
mailing list