parse-all-comments.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Run lines are sensitive to line numbers and come below the code.
  2. #ifndef HEADER
  3. #define HEADER
  4. // Not a Doxygen comment. notdoxy1 NOT_DOXYGEN
  5. void notdoxy1(void);
  6. /* Not a Doxygen comment. notdoxy2 NOT_DOXYGEN */
  7. void notdoxy2(void);
  8. /*/ Not a Doxygen comment. notdoxy3 NOT_DOXYGEN */
  9. void notdoxy3(void);
  10. /** Doxygen comment. isdoxy4 IS_DOXYGEN_SINGLE */
  11. void isdoxy4(void);
  12. /*! Doxygen comment. isdoxy5 IS_DOXYGEN_SINGLE */
  13. void isdoxy5(void);
  14. /// Doxygen comment. isdoxy6 IS_DOXYGEN_SINGLE
  15. void isdoxy6(void);
  16. /* BLOCK_ORDINARY_COMMENT */
  17. // ORDINARY COMMENT
  18. /// This is a BCPL comment. IS_DOXYGEN_START
  19. /// It has only two lines.
  20. /** But there are other blocks that are part of the comment, too. IS_DOXYGEN_END */
  21. void multi_line_comment_plus_ordinary(int);
  22. // MULTILINE COMMENT
  23. //
  24. // WITH EMPTY LINE
  25. void multi_line_comment_empty_line(int);
  26. #endif
  27. // RUN: rm -rf %t
  28. // RUN: mkdir %t
  29. // RUN: %clang_cc1 -fparse-all-comments -x c++ -std=c++11 -emit-pch -o %t/out.pch %s
  30. // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s -std=c++11 -fparse-all-comments > %t/out.c-index-direct
  31. // RUN: c-index-test -test-load-tu %t/out.pch all > %t/out.c-index-pch
  32. // RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-direct
  33. // RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-pch
  34. // Ensure that XML is not invalid
  35. // WRONG-NOT: CommentXMLInvalid
  36. // RUN: FileCheck %s < %t/out.c-index-direct
  37. // RUN: FileCheck %s < %t/out.c-index-pch
  38. // CHECK: parse-all-comments.c:7:6: FunctionDecl=notdoxy1:{{.*}} notdoxy1 NOT_DOXYGEN
  39. // CHECK: parse-all-comments.c:10:6: FunctionDecl=notdoxy2:{{.*}} notdoxy2 NOT_DOXYGEN
  40. // CHECK: parse-all-comments.c:13:6: FunctionDecl=notdoxy3:{{.*}} notdoxy3 NOT_DOXYGEN
  41. // CHECK: parse-all-comments.c:16:6: FunctionDecl=isdoxy4:{{.*}} isdoxy4 IS_DOXYGEN_SINGLE
  42. // CHECK: parse-all-comments.c:19:6: FunctionDecl=isdoxy5:{{.*}} isdoxy5 IS_DOXYGEN_SINGLE
  43. // CHECK: parse-all-comments.c:22:6: FunctionDecl=isdoxy6:{{.*}} isdoxy6 IS_DOXYGEN_SINGLE
  44. // CHECK: parse-all-comments.c:29:6: FunctionDecl=multi_line_comment_plus_ordinary:{{.*}} BLOCK_ORDINARY_COMMENT {{.*}} ORDINARY COMMENT {{.*}} IS_DOXYGEN_START {{.*}} IS_DOXYGEN_END
  45. // CHECK: parse-all-comments.c:34:6: FunctionDecl=multi_line_comment_empty_line:{{.*}} MULTILINE COMMENT{{.*}}\n{{.*}}\n{{.*}} WITH EMPTY LINE