On Sep 28, 2012, at 3:35 PM, Fariborz Jahanian <[email protected]> wrote:
> Author: fjahanian > Date: Fri Sep 28 17:35:49 2012 > New Revision: 164861 > > URL: http://llvm.org/viewvc/llvm-project?rev=164861&view=rev > Log: > [Doc parsing] Add availability information to generated Comment XML. Nifty. > (I still need to add a test once I figure it out). Looking forward to it... in general, it'd be better to have a test with the initial commit. > Reviewed off-line by Doug. // rdar://12378879 I still have some comments :) > Modified: > cfe/trunk/bindings/xml/comment-xml-schema.rng > 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=164861&r1=164860&r2=164861&view=diff > ============================================================================== > --- cfe/trunk/bindings/xml/comment-xml-schema.rng (original) > +++ cfe/trunk/bindings/xml/comment-xml-schema.rng Fri Sep 28 17:35:49 2012 > @@ -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> > + Why the <Attribute> wrapping <Availability>? We don't need it, and it's not part of the DocSet XML format. > <define name="Abstract"> > <element name="Abstract"> > <zeroOrMore> > > Modified: cfe/trunk/tools/libclang/CXComment.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXComment.cpp?rev=164861&r1=164860&r2=164861&view=diff > ============================================================================== > --- cfe/trunk/tools/libclang/CXComment.cpp (original) > +++ cfe/trunk/tools/libclang/CXComment.cpp Fri Sep 28 17:35:49 2012 > @@ -1170,7 +1170,62 @@ > 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"; > + } I agree with Dmitri, and suggest here that you map macosx -> OS X, ios -> iOS, and pass through the other names. Isn't there already code to do this in the AST library? Can it be abstracted nicely? - Doug _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
