diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2012-06-27 23:43:37 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2012-06-27 23:43:37 +0000 |
commit | 8bdb58a7835a9a90dd9b9791fccf269cbc1dcef3 (patch) | |
tree | 8113d564235d6d532d37eda0b1769ffab74ba993 | |
parent | 5676d32a23faf0506f5c295980c2876c862488d5 (diff) |
Attaching documentation comments to declarations: don't attach a comment to a declaration if there is a preprocessor directive between them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159305 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/ASTContext.cpp | 5 | ||||
-rw-r--r-- | test/Index/annotate-comments.cpp | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index ca631736d9..9fb2dc1a94 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -134,8 +134,9 @@ const RawComment *ASTContext::getRawCommentForDeclNoCache(const Decl *D) const { StringRef Text(Buffer + CommentEndDecomp.second, DeclLocDecomp.second - CommentEndDecomp.second); - // There should be no other declarations between comment and declaration. - if (Text.find_first_of(",;{}") != StringRef::npos) + // There should be no other declarations or preprocessor directives between + // comment and declaration. + if (Text.find_first_of(",;{}#") != StringRef::npos) return NULL; return &*Comment; diff --git a/test/Index/annotate-comments.cpp b/test/Index/annotate-comments.cpp index 64d1c983bc..cb0630b739 100644 --- a/test/Index/annotate-comments.cpp +++ b/test/Index/annotate-comments.cpp @@ -194,6 +194,10 @@ void isdoxy44(void); /// Ggg. IS_DOXYGEN_END void isdoxy45(void); +/// IS_DOXYGEN_NOT_ATTACHED +#define FOO +void notdoxy46(void); + #endif // RUN: rm -rf %t |