From b3e8172e9e513abffd0ced1a2c47fe3549b27e8e Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Mon, 19 Aug 2013 07:13:02 +0000 Subject: [PATCH] Comment parsing tests: move tests where they belong Move C++-specific tests that were checking if we attach a base class comment to a derived class to an existing test comment-to-html-xml-conversion.cpp. Note that the original testing approach was not actually testing the class--comment relationship. It only checked that we attached the comment *somewhere*. The rest of subclass-comment.mm should be also moved elsewhere. llvm-svn: 188658 --- .../Index/comment-to-html-xml-conversion.cpp | 51 ++++++++++++++ clang/test/Index/subclass-comment.mm | 66 +------------------ 2 files changed, 52 insertions(+), 65 deletions(-) diff --git a/clang/test/Index/comment-to-html-xml-conversion.cpp b/clang/test/Index/comment-to-html-xml-conversion.cpp index ed25c503ae9f..9a7cd9af9bd9 100644 --- a/clang/test/Index/comment-to-html-xml-conversion.cpp +++ b/clang/test/Index/comment-to-html-xml-conversion.cpp @@ -785,6 +785,57 @@ enum class comment_to_xml_conversion_17 { // CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-1]]:3: EnumConstantDecl=comment_to_xml_conversion_18:{{.*}} FullCommentAsXML=[comment_to_xml_conversion_18c:@E@comment_to_xml_conversion_17@comment_to_xml_conversion_18comment_to_xml_conversion_18 Aaa.] }; +//===--- +// Check that we attach comments from the base class to derived classes if they don't have a comment. +// rdar://13647476 +//===--- + +/// BaseToSuper1_Base +class BaseToSuper1_Base {}; + +class BaseToSuper1_Derived : public BaseToSuper1_Base {}; +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-1]]:7: ClassDecl=BaseToSuper1_Derived:{{.*}} FullCommentAsXML=[BaseToSuper1_Basec:@C@BaseToSuper1_Baseclass BaseToSuper1_Derived : public BaseToSuper1_Base {} BaseToSuper1_Base] + + +/// BaseToSuper2_Base +class BaseToSuper2_Base {}; + +/// BaseToSuper2_Derived +class BaseToSuper2_Derived : public BaseToSuper2_Base {}; +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-1]]:7: ClassDecl=BaseToSuper2_Derived:{{.*}} FullCommentAsXML=[BaseToSuper2_Derivedc:@C@BaseToSuper2_Derivedclass BaseToSuper2_Derived : public BaseToSuper2_Base {} BaseToSuper2_Derived] + +class BaseToSuper2_MoreDerived : public BaseToSuper2_Derived {}; +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-1]]:7: ClassDecl=BaseToSuper2_MoreDerived:{{.*}} FullCommentAsXML=[BaseToSuper2_Derivedc:@C@BaseToSuper2_Derivedclass BaseToSuper2_MoreDerived : public BaseToSuper2_Derived {} BaseToSuper2_Derived] + + +/// BaseToSuper3_Base +class BaseToSuper3_Base {}; + +class BaseToSuper3_DerivedA : public virtual BaseToSuper3_Base {}; + +class BaseToSuper3_DerivedB : public virtual BaseToSuper3_Base {}; + +class BaseToSuper3_MoreDerived : public BaseToSuper3_DerivedA, public BaseToSuper3_DerivedB {}; +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-1]]:7: ClassDecl=BaseToSuper3_MoreDerived:{{.*}} FullCommentAsXML=[BaseToSuper3_Basec:@C@BaseToSuper3_Baseclass BaseToSuper3_MoreDerived : public BaseToSuper3_DerivedA,\n public BaseToSuper3_DerivedB {} BaseToSuper3_Base] + + +// Check that we propagate comments only through public inheritance. + +/// BaseToSuper4_Base +class BaseToSuper4_Base {}; + +/// BaseToSuper4_DerivedA +class BaseToSuper4_DerivedA : virtual BaseToSuper4_Base {}; + +class BaseToSuper4_DerivedB : public virtual BaseToSuper4_Base {}; + +class BaseToSuper4_MoreDerived : BaseToSuper4_DerivedA, public BaseToSuper4_DerivedB {}; +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-1]]:7: ClassDecl=BaseToSuper4_MoreDerived:{{.*}} FullCommentAsXML=[BaseToSuper4_Basec:@C@BaseToSuper4_Baseclass BaseToSuper4_MoreDerived : BaseToSuper4_DerivedA,\n public BaseToSuper4_DerivedB {} BaseToSuper4_Base] + +//===--- +// Check the representation of \todo in XML. +//===--- + /// Aaa. /// \todo Bbb. void comment_to_xml_conversion_todo_1(); diff --git a/clang/test/Index/subclass-comment.mm b/clang/test/Index/subclass-comment.mm index 9682a9f71d6c..5fcb89fe632b 100644 --- a/clang/test/Index/subclass-comment.mm +++ b/clang/test/Index/subclass-comment.mm @@ -13,7 +13,7 @@ // CHECK-NEXT: (CXComment_Text Text=[ NSObject is root of all.])))] //! An umbrella class for super classes. -@interface SuperClass +@interface SuperClass @end // CHECK: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment @@ -41,67 +41,3 @@ // CHECK-NEXT: (CXComment_Paragraph // CHECK-NEXT: (CXComment_Text Text=[ An umbrella class for super classes.])))] -//! Something valuable to the organization. -class Asset { -}; -// CHECK: CommentAST=[ -// CHECK-NEXT: (CXComment_FullComment -// CHECK-NEXT: (CXComment_Paragraph -// CHECK-NEXT: (CXComment_Text Text=[ Something valuable to the organization.])))] - -//! An individual human or human individual. -class Person : public Asset { -}; -// CHECK: CommentAST=[ -// CHECK-NEXT: (CXComment_FullComment -// CHECK-NEXT: (CXComment_Paragraph -// CHECK-NEXT: (CXComment_Text Text=[ An individual human or human individual.])))] - -class Student : public Person { -}; -// CHECK: CommentAST=[ -// CHECK-NEXT: (CXComment_FullComment -// CHECK-NEXT: (CXComment_Paragraph -// CHECK-NEXT: (CXComment_Text Text=[ An individual human or human individual.])))] - -//! Every thing is a part -class Parts { -}; -// CHECK: CommentAST=[ -// CHECK-NEXT: (CXComment_FullComment -// CHECK-NEXT: (CXComment_Paragraph -// CHECK-NEXT: (CXComment_Text Text=[ Every thing is a part])))] - -class Window : public virtual Parts { -}; -// CHECK: CommentAST=[ -// CHECK-NEXT: (CXComment_FullComment -// CHECK-NEXT: (CXComment_Paragraph -// CHECK-NEXT: (CXComment_Text Text=[ Every thing is a part])))] - -class Door : public virtual Parts { -}; -// CHECK: CommentAST=[ -// CHECK-NEXT: (CXComment_FullComment -// CHECK-NEXT: (CXComment_Paragraph -// CHECK-NEXT: (CXComment_Text Text=[ Every thing is a part])))] - -class House : public Window, Door { -}; -// CHECK: CommentAST=[ -// CHECK-NEXT: (CXComment_FullComment -// CHECK-NEXT: (CXComment_Paragraph -// CHECK-NEXT: (CXComment_Text Text=[ Every thing is a part])))] - -//! Any Material -class Material : virtual Parts { -}; - -class Building : Window, public Material { -}; -// CHECK: CommentAST=[ -// CHECK-NEXT: (CXComment_FullComment -// CHECK-NEXT: (CXComment_Paragraph -// CHECK-NEXT: (CXComment_Text Text=[ Any Material])))] - - -- GitLab