r180646 - documenttion parsing. Provide a c-index test
Fariborz Jahanian
fjahanian at apple.com
Fri Apr 26 16:34:37 PDT 2013
Author: fjahanian
Date: Fri Apr 26 18:34:36 2013
New Revision: 180646
URL: http://llvm.org/viewvc/llvm-project?rev=180646&view=rev
Log:
documenttion parsing. Provide a c-index test
and limit comment extraction to public c++
bases. // rdar://13647476
Added:
cfe/trunk/test/Index/subclass-comment.mm
- copied, changed from r180629, cfe/trunk/test/Misc/ast-dump-subclass-comment.mm
Removed:
cfe/trunk/test/Misc/ast-dump-subclass-comment.mm
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=180646&r1=180645&r2=180646&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Apr 26 18:34:36 2013
@@ -469,7 +469,7 @@ comments::FullComment *ASTContext::getCo
// Check non-virtual bases.
for (CXXRecordDecl::base_class_const_iterator I =
RD->bases_begin(), E = RD->bases_end(); I != E; ++I) {
- if (I->isVirtual())
+ if (I->isVirtual() || (I->getAccessSpecifier() != AS_public))
continue;
QualType Ty = I->getType();
if (Ty.isNull())
@@ -485,6 +485,8 @@ comments::FullComment *ASTContext::getCo
// Check virtual bases.
for (CXXRecordDecl::base_class_const_iterator I =
RD->vbases_begin(), E = RD->vbases_end(); I != E; ++I) {
+ if (I->getAccessSpecifier() != AS_public)
+ continue;
QualType Ty = I->getType();
if (Ty.isNull())
continue;
Copied: cfe/trunk/test/Index/subclass-comment.mm (from r180629, cfe/trunk/test/Misc/ast-dump-subclass-comment.mm)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/subclass-comment.mm?p2=cfe/trunk/test/Index/subclass-comment.mm&p1=cfe/trunk/test/Misc/ast-dump-subclass-comment.mm&r1=180629&r2=180646&rev=180646&view=diff
==============================================================================
--- cfe/trunk/test/Misc/ast-dump-subclass-comment.mm (original)
+++ cfe/trunk/test/Index/subclass-comment.mm Fri Apr 26 18:34:36 2013
@@ -1,101 +1,107 @@
-// RUN: %clang_cc1 -x objective-c++ -Wdocumentation -ast-dump %s | FileCheck %s
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s > %t/out
+// RUN: FileCheck %s < %t/out
// rdar://13647476
//! NSObject is root of all.
@interface NSObject
@end
-// CHECK: ObjCInterfaceDecl{{.*}}NSObject
-// CHECK-NEXT: FullComment 0x{{[^ ]*}} <line:[[@LINE-4]]:4, col:28>
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:28>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:28> Text=" NSObject is root of all."
+// CHECK: CommentAST=[
+// CHECK-NEXT: (CXComment_FullComment
+// CHECK-NEXT: (CXComment_Paragraph
+// CHECK-NEXT: (CXComment_Text Text=[ NSObject is root of all.])))]
//! An umbrella class for super classes.
@interface SuperClass
@end
-// CHECK: ObjCInterfaceDecl{{.*}}SuperClass
-// CHECK-NEXT: FullComment 0x{{[^ ]*}} <line:[[@LINE-4]]:4, col:40>
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:40>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:40> Text=" An umbrella class for super classes."
+// CHECK: CommentAST=[
+// CHECK-NEXT: (CXComment_FullComment
+// CHECK-NEXT: (CXComment_Paragraph
+// CHECK-NEXT: (CXComment_Text Text=[ An umbrella class for super classes.])))]
@interface SubClass : SuperClass
@end
-// CHECK: ObjCInterfaceDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:2> SubClass
-// CHECK-NEXT: ObjCInterface 0x{{[^ ]*}} 'SuperClass'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:40>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:40> Text=" An umbrella class for super classes."
+// CHECK: CommentAST=[
+// CHECK-NEXT: (CXComment_FullComment
+// CHECK-NEXT: (CXComment_Paragraph
+// CHECK-NEXT: (CXComment_Text Text=[ An umbrella class for super classes.])))]
@interface SubSubClass : SubClass
@end
-// CHECK: ObjCInterfaceDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:2> SubSubClass
-// CHECK-NEXT: ObjCInterface{{.*}} 'SubClass'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:40>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:40> Text=" An umbrella class for super classes."
+// CHECK: CommentAST=[
+// CHECK-NEXT: (CXComment_FullComment
+// CHECK-NEXT: (CXComment_Paragraph
+// CHECK-NEXT: (CXComment_Text Text=[ An umbrella class for super classes.])))]
@interface SubSubClass (Private)
@end
-// CHECK: ObjCCategoryDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:2> Private
-// CHECK-NEXT: ObjCInterface{{.*}} 'SubSubClass'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:40>
-// CHECK-TEXT: TextComment{{.*}} <col:4, col:40> Text=" An umbrella class for super classes."
+// CHECK: CommentAST=[
+// CHECK-NEXT: (CXComment_FullComment
+// CHECK-NEXT: (CXComment_Paragraph
+// CHECK-NEXT: (CXComment_Text Text=[ An umbrella class for super classes.])))]
//! Something valuable to the organization.
class Asset {
-
};
-// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-3]]:1, line:[[@LINE-1]]:1> class Asset
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:43>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:43> Text=" Something valuable to the organization."
+// 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: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:1> class Person
-// CHECK-NEXT: public 'class Asset'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:44>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:44> Text=" An individual human or human individual."
+// 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: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:1> class Student
-// CHECK-NEXT: public 'class Person'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:44>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:44> Text=" An individual human or human individual."
+// 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: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:1> class Parts
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:25>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:25> Text=" Every thing is a part"
-
-class Window : virtual Parts {
-};
-// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:1> class Window
-// CHECK-NEXT: virtual private 'class Parts'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:25>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:25> Text=" Every thing is a part"
-
-class Door : virtual Parts {
-};
-// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:1> class Door
-// CHECK-NEXT: virtual private 'class Parts'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:25>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:25> Text=" Every thing is a part"
-
-class House : Window, Door {
-};
-// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:1> class House
-// CHECK-NEXT: private 'class Window'
-// CHECK-NEXT: private 'class Door'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:25>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:25> Text=" Every thing is a part"
+// 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])))]
+
+
Removed: cfe/trunk/test/Misc/ast-dump-subclass-comment.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/ast-dump-subclass-comment.mm?rev=180645&view=auto
==============================================================================
--- cfe/trunk/test/Misc/ast-dump-subclass-comment.mm (original)
+++ cfe/trunk/test/Misc/ast-dump-subclass-comment.mm (removed)
@@ -1,101 +0,0 @@
-// RUN: %clang_cc1 -x objective-c++ -Wdocumentation -ast-dump %s | FileCheck %s
-// rdar://13647476
-
-//! NSObject is root of all.
- at interface NSObject
- at end
-// CHECK: ObjCInterfaceDecl{{.*}}NSObject
-// CHECK-NEXT: FullComment 0x{{[^ ]*}} <line:[[@LINE-4]]:4, col:28>
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:28>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:28> Text=" NSObject is root of all."
-
-//! An umbrella class for super classes.
- at interface SuperClass
- at end
-// CHECK: ObjCInterfaceDecl{{.*}}SuperClass
-// CHECK-NEXT: FullComment 0x{{[^ ]*}} <line:[[@LINE-4]]:4, col:40>
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:40>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:40> Text=" An umbrella class for super classes."
-
- at interface SubClass : SuperClass
- at end
-// CHECK: ObjCInterfaceDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:2> SubClass
-// CHECK-NEXT: ObjCInterface 0x{{[^ ]*}} 'SuperClass'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:40>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:40> Text=" An umbrella class for super classes."
-
- at interface SubSubClass : SubClass
- at end
-// CHECK: ObjCInterfaceDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:2> SubSubClass
-// CHECK-NEXT: ObjCInterface{{.*}} 'SubClass'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:40>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:40> Text=" An umbrella class for super classes."
-
- at interface SubSubClass (Private)
- at end
-// CHECK: ObjCCategoryDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:2> Private
-// CHECK-NEXT: ObjCInterface{{.*}} 'SubSubClass'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:40>
-// CHECK-TEXT: TextComment{{.*}} <col:4, col:40> Text=" An umbrella class for super classes."
-
-//! Something valuable to the organization.
-class Asset {
-
-};
-// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-3]]:1, line:[[@LINE-1]]:1> class Asset
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:43>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:43> Text=" Something valuable to the organization."
-
-//! An individual human or human individual.
-class Person : public Asset {
-};
-// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:1> class Person
-// CHECK-NEXT: public 'class Asset'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:44>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:44> Text=" An individual human or human individual."
-
-class Student : public Person {
-};
-// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:1> class Student
-// CHECK-NEXT: public 'class Person'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:44>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:44> Text=" An individual human or human individual."
-
-//! Every thing is a part
-class Parts {
-};
-// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:1> class Parts
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:25>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:25> Text=" Every thing is a part"
-
-class Window : virtual Parts {
-};
-// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:1> class Window
-// CHECK-NEXT: virtual private 'class Parts'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:25>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:25> Text=" Every thing is a part"
-
-class Door : virtual Parts {
-};
-// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:1> class Door
-// CHECK-NEXT: virtual private 'class Parts'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:25>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:25> Text=" Every thing is a part"
-
-class House : Window, Door {
-};
-// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:1> class House
-// CHECK-NEXT: private 'class Window'
-// CHECK-NEXT: private 'class Door'
-// CHECK-NEXT: FullComment
-// CHECK-NEXT: ParagraphComment{{.*}} <col:4, col:25>
-// CHECK-NEXT: TextComment{{.*}} <col:4, col:25> Text=" Every thing is a part"
More information about the cfe-commits
mailing list