forked from OSchip/llvm-project
[Doc parsing] Add availability information to generated Comment XML.
(I still need to add a test once I figure it out). Reviewed off-line by Doug. // rdar://12378879 llvm-svn: 164861
This commit is contained in:
parent
0be9c40925
commit
35760a8937
|
@ -79,6 +79,9 @@
|
|||
<optional>
|
||||
<ref name="Parameters" />
|
||||
</optional>
|
||||
<zeroOrMore>
|
||||
<ref name="Attribute" />
|
||||
</zeroOrMore>
|
||||
<optional>
|
||||
<ref name="ResultDiscussion" />
|
||||
</optional>
|
||||
|
@ -284,6 +287,39 @@
|
|||
</element>
|
||||
</define>
|
||||
|
||||
<define name="Attribute">
|
||||
<element name="Availability">
|
||||
<attribute name="distribution">
|
||||
<data type="string" />
|
||||
</attribute>
|
||||
<optional>
|
||||
<element name="IntroducedInVersion">
|
||||
<data type="float" />
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="DeprecatedInVersion">
|
||||
<data type="float" />
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="RemovedAfterVersion">
|
||||
<data type="float" />
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="DeprecationSummary">
|
||||
<data type="string" />
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="Unavailable">
|
||||
<data type="boolean" />
|
||||
</element>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name="Abstract">
|
||||
<element name="Abstract">
|
||||
<zeroOrMore>
|
||||
|
|
|
@ -1170,7 +1170,62 @@ void CommentASTToXMLConverter::visitFullComment(const FullComment *C) {
|
|||
visit(Parts.Returns);
|
||||
Result << "</ResultDiscussion>";
|
||||
}
|
||||
|
||||
|
||||
if (DI->ThisDecl->hasAttrs()) {
|
||||
const AttrVec &Attrs = DI->ThisDecl->getAttrs();
|
||||
for (unsigned i = 0, e = Attrs.size(); i != e;) {
|
||||
const AvailabilityAttr *AA = dyn_cast<AvailabilityAttr>(Attrs[i++]);
|
||||
if (!AA)
|
||||
continue;
|
||||
// availability attribute info.
|
||||
|
||||
Result << "<Availability";
|
||||
StringRef distribution;
|
||||
if (AA->getPlatform()) {
|
||||
distribution = AA->getPlatform()->getName();
|
||||
if (distribution == "macosx")
|
||||
distribution = "OSX";
|
||||
else
|
||||
distribution = "iOS";
|
||||
}
|
||||
|
||||
Result << " distribution=\"";
|
||||
Result << distribution;
|
||||
Result << "\">";
|
||||
VersionTuple IntroducedInVersion = AA->getIntroduced();
|
||||
if (!IntroducedInVersion.empty()) {
|
||||
Result << " <IntroducedInVersion>";
|
||||
Result << IntroducedInVersion.getAsString();
|
||||
Result << "</IntroducedInVersion>";
|
||||
}
|
||||
VersionTuple DeprecatedInVersion = AA->getDeprecated();
|
||||
if (!DeprecatedInVersion.empty()) {
|
||||
Result << " <DeprecatedInVersion>";
|
||||
Result << DeprecatedInVersion.getAsString();
|
||||
Result << "</DeprecatedInVersion>";
|
||||
}
|
||||
VersionTuple RemovedAfterVersion = AA->getObsoleted();
|
||||
if (!RemovedAfterVersion.empty()) {
|
||||
Result << " <RemovedAfterVersion>";
|
||||
Result << RemovedAfterVersion.getAsString();
|
||||
Result << "</RemovedAfterVersion>";
|
||||
}
|
||||
StringRef DeprecationSummary = AA->getMessage();
|
||||
if (!DeprecationSummary.empty()) {
|
||||
Result << " <DeprecationSummary>";
|
||||
Result << DeprecationSummary;
|
||||
Result << "</DeprecationSummary>";
|
||||
}
|
||||
Result << " <Unavailable>";
|
||||
if (AA->getUnavailable())
|
||||
Result << "true";
|
||||
else
|
||||
Result << "false";
|
||||
Result << "</Unavailable>";
|
||||
Result << " </Availability>";
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
bool StartTagEmitted = false;
|
||||
for (unsigned i = 0, e = Parts.MiscBlocks.size(); i != e; ++i) {
|
||||
|
|
Loading…
Reference in New Issue