From 9c00676f2393335dc60c61faf944d4f8f622fac6 Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Fri, 6 Jul 2012 23:27:33 +0000 Subject: [PATCH] Restrict the set of declaration kinds for which we allow trailing comments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159878 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ASTContext.cpp | 2 +- test/Index/annotate-comments.cpp | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 12f1d4de03..a5b624fbec 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -99,7 +99,7 @@ const RawComment *ASTContext::getRawCommentForDeclNoCache(const Decl *D) const { // First check whether we have a trailing comment. if (Comment != RawComments.end() && (*Comment)->isDocumentation() && (*Comment)->isTrailingComment() && - !isa(D) && !isa(D)) { + (isa(D) || isa(D) || isa(D))) { std::pair CommentBeginDecomp = SourceMgr.getDecomposedLoc((*Comment)->getSourceRange().getBegin()); // Check that Doxygen trailing comment comes after the declaration, starts diff --git a/test/Index/annotate-comments.cpp b/test/Index/annotate-comments.cpp index aa68defe95..18dab24618 100644 --- a/test/Index/annotate-comments.cpp +++ b/test/Index/annotate-comments.cpp @@ -95,11 +95,11 @@ void isdoxy19(int, int); /** But there are other blocks that are part of the comment, too. IS_DOXYGEN_END */ void isdoxy20(int); -void isdoxy21(int); ///< This is a member comment. isdoxy21 IS_DOXYGEN_SINGLE +void notdoxy21(int); ///< This is a member comment. isdoxy21 IS_DOXYGEN_NOT_ATTACHED -void isdoxy22(int); /*!< This is a member comment. isdoxy22 IS_DOXYGEN_SINGLE */ +void notdoxy22(int); /*!< This is a member comment. isdoxy22 IS_DOXYGEN_NOT_ATTACHED */ -void isdoxy23(int); /**< This is a member comment. isdoxy23 IS_DOXYGEN_SINGLE */ +void notdoxy23(int); /**< This is a member comment. isdoxy23 IS_DOXYGEN_NOT_ATTACHED */ void notdoxy24(int); // NOT_DOXYGEN @@ -248,9 +248,6 @@ void isdoxy47(int); // CHECK: annotate-comments.cpp:80:5: FunctionDecl=isdoxy18:{{.*}} isdoxy18 IS_DOXYGEN_START{{.*}} IS_DOXYGEN_END // CHECK: annotate-comments.cpp:90:6: FunctionDecl=isdoxy19:{{.*}} isdoxy19 IS_DOXYGEN_START{{.*}} IS_DOXYGEN_END // CHECK: annotate-comments.cpp:96:6: FunctionDecl=isdoxy20:{{.*}} isdoxy20 IS_DOXYGEN_START{{.*}} IS_DOXYGEN_END -// CHECK: annotate-comments.cpp:98:6: FunctionDecl=isdoxy21:{{.*}} isdoxy21 IS_DOXYGEN_SINGLE -// CHECK: annotate-comments.cpp:100:6: FunctionDecl=isdoxy22:{{.*}} isdoxy22 IS_DOXYGEN_SINGLE -// CHECK: annotate-comments.cpp:102:6: FunctionDecl=isdoxy23:{{.*}} isdoxy23 IS_DOXYGEN_SINGLE // CHECK: annotate-comments.cpp:107:8: StructDecl=isdoxy25:{{.*}} IS_DOXYGEN_SINGLE // CHECK: annotate-comments.cpp:112:7: FieldDecl=isdoxy26:{{.*}} IS_DOXYGEN_SINGLE // CHECK: annotate-comments.cpp:116:7: FieldDecl=isdoxy27:{{.*}} IS_DOXYGEN_SINGLE -- 2.40.0