[cfe-commits] r161442 - in /cfe/trunk: bindings/xml/comment-xml-schema.rng include/clang/AST/Comment.h lib/AST/Comment.cpp test/Index/Inputs/CommentXML/valid-enum-01.xml test/Index/annotate-comments.cpp test/Index/comment-xml-schema.c tools/libclang/CXComment.cpp
Dmitri Gribenko
gribozavr at gmail.com
Tue Aug 7 11:59:04 PDT 2012
Author: gribozavr
Date: Tue Aug 7 13:59:04 2012
New Revision: 161442
URL: http://llvm.org/viewvc/llvm-project?rev=161442&view=rev
Log:
Comment AST: DeclInfo: add a special kind for enums.
Comment XML: add a root node kind for enums.
Added:
cfe/trunk/test/Index/Inputs/CommentXML/valid-enum-01.xml
Modified:
cfe/trunk/bindings/xml/comment-xml-schema.rng
cfe/trunk/include/clang/AST/Comment.h
cfe/trunk/lib/AST/Comment.cpp
cfe/trunk/test/Index/annotate-comments.cpp
cfe/trunk/test/Index/comment-xml-schema.c
cfe/trunk/tools/libclang/CXComment.cpp
Modified: cfe/trunk/bindings/xml/comment-xml-schema.rng
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/xml/comment-xml-schema.rng?rev=161442&r1=161441&r2=161442&view=diff
==============================================================================
--- cfe/trunk/bindings/xml/comment-xml-schema.rng (original)
+++ cfe/trunk/bindings/xml/comment-xml-schema.rng Tue Aug 7 13:59:04 2012
@@ -13,6 +13,7 @@
<ref name="Variable" />
<ref name="Namespace" />
<ref name="Typedef" />
+ <ref name="Enum" />
</choice>
</start>
@@ -216,6 +217,36 @@
</element>
</define>
+ <define name="Enum">
+ <element name="Enum">
+ <ref name="attrSourceLocation" />
+ <ref name="Name" />
+ <optional>
+ <ref name="USR" />
+ </optional>
+ <optional>
+ <ref name="Abstract" />
+ </optional>
+
+ <!-- Template parameters, parameters and results don't make sense for
+ enums, but the user can specify \tparam \param or \returns in a
+ comment anyway. -->
+ <optional>
+ <ref name="TemplateParameters" />
+ </optional>
+ <optional>
+ <ref name="Parameters" />
+ </optional>
+ <optional>
+ <ref name="ResultDiscussion" />
+ </optional>
+
+ <optional>
+ <ref name="Discussion" />
+ </optional>
+ </element>
+ </define>
+
<define name="attrSourceLocation">
<optional>
<attribute name="file">
Modified: cfe/trunk/include/clang/AST/Comment.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Comment.h?rev=161442&r1=161441&r2=161442&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Comment.h (original)
+++ cfe/trunk/include/clang/AST/Comment.h Tue Aug 7 13:59:04 2012
@@ -962,7 +962,10 @@
/// A C++ typedef-name (a 'typedef' decl specifier or alias-declaration),
/// see \c TypedefNameDecl.
- TypedefKind
+ TypedefKind,
+
+ /// An enumeration or scoped enumeration.
+ EnumKind
};
/// What kind of template specialization \c ThisDecl is.
Modified: cfe/trunk/lib/AST/Comment.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Comment.cpp?rev=161442&r1=161441&r2=161442&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Comment.cpp (original)
+++ cfe/trunk/lib/AST/Comment.cpp Tue Aug 7 13:59:04 2012
@@ -251,6 +251,9 @@
TemplateParameters = TAT->getTemplateParameters();
break;
}
+ case Decl::Enum:
+ Kind = EnumKind;
+ break;
}
IsFilled = true;
Added: cfe/trunk/test/Index/Inputs/CommentXML/valid-enum-01.xml
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Inputs/CommentXML/valid-enum-01.xml?rev=161442&view=auto
==============================================================================
--- cfe/trunk/test/Index/Inputs/CommentXML/valid-enum-01.xml (added)
+++ cfe/trunk/test/Index/Inputs/CommentXML/valid-enum-01.xml Tue Aug 7 13:59:04 2012
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Enum>
+<Name>aaa</Name>
+<Abstract><Para>Aaa.</Para></Abstract>
+</Enum>
+
Modified: cfe/trunk/test/Index/annotate-comments.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/annotate-comments.cpp?rev=161442&r1=161441&r2=161442&view=diff
==============================================================================
--- cfe/trunk/test/Index/annotate-comments.cpp (original)
+++ cfe/trunk/test/Index/annotate-comments.cpp Tue Aug 7 13:59:04 2012
@@ -428,11 +428,18 @@
}
}
+/// Aaa.
enum comment_to_xml_conversion_15 {
/// Aaa.
comment_to_xml_conversion_16
};
+/// Aaa.
+enum class comment_to_xml_conversion_17 {
+ /// Aaa.
+ comment_to_xml_conversion_18
+};
+
#endif
// RUN: rm -rf %t
@@ -889,4 +896,7 @@
// CHECK: annotate-comments.cpp:422:5: VarDecl=comment_to_xml_conversion_12:{{.*}} FullCommentAsXML=[<Variable file="{{[^"]+}}annotate-comments.cpp" line="422" column="5"><Name>comment_to_xml_conversion_12</Name><USR>c:@comment_to_xml_conversion_12</USR><Abstract><Para> Aaa.</Para></Abstract></Variable>]
// CHECK: annotate-comments.cpp:425:11: Namespace=comment_to_xml_conversion_13:{{.*}} FullCommentAsXML=[<Namespace file="{{[^"]+}}annotate-comments.cpp" line="425" column="11"><Name>comment_to_xml_conversion_13</Name><USR>c:@N at comment_to_xml_conversion_13</USR><Abstract><Para> Aaa.</Para></Abstract></Namespace>]
// CHECK: annotate-comments.cpp:427:13: Namespace=comment_to_xml_conversion_14:{{.*}} FullCommentAsXML=[<Namespace file="{{[^"]+}}annotate-comments.cpp" line="427" column="13"><Name>comment_to_xml_conversion_14</Name><USR>c:@N at comment_to_xml_conversion_13@N at comment_to_xml_conversion_14</USR><Abstract><Para> Aaa.</Para></Abstract></Namespace>]
-// CHECK: annotate-comments.cpp:433:3: EnumConstantDecl=comment_to_xml_conversion_16:{{.*}} FullCommentAsXML=[<Variable file="{{[^"]+}}annotate-comments.cpp" line="433" column="3"><Name>comment_to_xml_conversion_16</Name><USR>c:@E at comment_to_xml_conversion_15@comment_to_xml_conversion_16</USR><Abstract><Para> Aaa.</Para></Abstract></Variable>]
+// CHECK: annotate-comments.cpp:432:6: EnumDecl=comment_to_xml_conversion_15:{{.*}} FullCommentAsXML=[<Enum file="{{[^"]+}}annotate-comments.cpp" line="432" column="6"><Name>comment_to_xml_conversion_15</Name><USR>c:@E at comment_to_xml_conversion_15</USR><Abstract><Para> Aaa.</Para></Abstract></Enum>]
+// CHECK: annotate-comments.cpp:434:3: EnumConstantDecl=comment_to_xml_conversion_16:{{.*}} FullCommentAsXML=[<Variable file="{{[^"]+}}annotate-comments.cpp" line="434" column="3"><Name>comment_to_xml_conversion_16</Name><USR>c:@E at comment_to_xml_conversion_15@comment_to_xml_conversion_16</USR><Abstract><Para> Aaa.</Para></Abstract></Variable>]
+// CHECK: annotate-comments.cpp:438:12: EnumDecl=comment_to_xml_conversion_17:{{.*}} FullCommentAsXML=[<Enum file="{{[^"]+}}annotate-comments.cpp" line="438" column="12"><Name>comment_to_xml_conversion_17</Name><USR>c:@E at comment_to_xml_conversion_17</USR><Abstract><Para> Aaa.</Para></Abstract></Enum>]
+// CHECK: annotate-comments.cpp:440:3: EnumConstantDecl=comment_to_xml_conversion_18:{{.*}} FullCommentAsXML=[<Variable file="{{[^"]+}}annotate-comments.cpp" line="440" column="3"><Name>comment_to_xml_conversion_18</Name><USR>c:@E at comment_to_xml_conversion_17@comment_to_xml_conversion_18</USR><Abstract><Para> Aaa.</Para></Abstract></Variable>]
Modified: cfe/trunk/test/Index/comment-xml-schema.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/comment-xml-schema.c?rev=161442&r1=161441&r2=161442&view=diff
==============================================================================
--- cfe/trunk/test/Index/comment-xml-schema.c (original)
+++ cfe/trunk/test/Index/comment-xml-schema.c Tue Aug 7 13:59:04 2012
@@ -23,7 +23,8 @@
//
// RUN: xmllint --noout --relaxng %S/../../bindings/xml/comment-xml-schema.rng %S/Inputs/CommentXML/valid-typedef-01.xml
// RUN: xmllint --noout --relaxng %S/../../bindings/xml/comment-xml-schema.rng %S/Inputs/CommentXML/valid-typedef-02.xml
-
+//
+// RUN: xmllint --noout --relaxng %S/../../bindings/xml/comment-xml-schema.rng %S/Inputs/CommentXML/valid-enum-01.xml
// RUN: xmllint --noout --relaxng %S/../../bindings/xml/comment-xml-schema.rng %S/Inputs/CommentXML/invalid-function-01.xml 2>&1 | FileCheck %s -check-prefix=INVALID
// RUN: xmllint --noout --relaxng %S/../../bindings/xml/comment-xml-schema.rng %S/Inputs/CommentXML/invalid-function-02.xml 2>&1 | FileCheck %s -check-prefix=INVALID
Modified: cfe/trunk/tools/libclang/CXComment.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXComment.cpp?rev=161442&r1=161441&r2=161442&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXComment.cpp (original)
+++ cfe/trunk/tools/libclang/CXComment.cpp Tue Aug 7 13:59:04 2012
@@ -1065,6 +1065,10 @@
RootEndTag = "</Typedef>";
Result << "<Typedef";
break;
+ case DeclInfo::EnumKind:
+ RootEndTag = "</Enum>";
+ Result << "<Enum";
+ break;
}
{
More information about the cfe-commits
mailing list