[cfe-commits] r159305 - in /cfe/trunk: lib/AST/ASTContext.cpp test/Index/annotate-comments.cpp

Dmitri Gribenko gribozavr at gmail.com
Wed Jun 27 16:43:38 PDT 2012


Author: gribozavr
Date: Wed Jun 27 18:43:37 2012
New Revision: 159305

URL: http://llvm.org/viewvc/llvm-project?rev=159305&view=rev
Log:
Attaching documentation comments to declarations: don't attach a comment to a declaration if there is a preprocessor directive between them.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/test/Index/annotate-comments.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=159305&r1=159304&r2=159305&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Jun 27 18:43:37 2012
@@ -134,8 +134,9 @@
   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;

Modified: cfe/trunk/test/Index/annotate-comments.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/annotate-comments.cpp?rev=159305&r1=159304&r2=159305&view=diff
==============================================================================
--- cfe/trunk/test/Index/annotate-comments.cpp (original)
+++ cfe/trunk/test/Index/annotate-comments.cpp Wed Jun 27 18:43:37 2012
@@ -194,6 +194,10 @@
 /// Ggg. IS_DOXYGEN_END
 void isdoxy45(void);
 
+/// IS_DOXYGEN_NOT_ATTACHED
+#define FOO
+void notdoxy46(void);
+
 #endif
 
 // RUN: rm -rf %t





More information about the cfe-commits mailing list