diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-10-01 18:42:25 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-10-01 18:42:25 +0000 |
commit | faab5618b5beed350d7444de97cf513ef1a42ca6 (patch) | |
tree | 60fd3cc915265951e3e883a9b70f4a6a15a0f081 /tools/libclang/CXComment.cpp | |
parent | 622b6fb0a1d280c16e135c7e427b79cafffbde1f (diff) |
availability in structured documents. Takes
care of comments by Dimitri and Doug.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164957 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CXComment.cpp')
-rw-r--r-- | tools/libclang/CXComment.cpp | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/tools/libclang/CXComment.cpp b/tools/libclang/CXComment.cpp index a132a0d1ba..1e0679f22a 100644 --- a/tools/libclang/CXComment.cpp +++ b/tools/libclang/CXComment.cpp @@ -1173,59 +1173,53 @@ void CommentASTToXMLConverter::visitFullComment(const FullComment *C) { 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++]); + for (unsigned i = 0, e = Attrs.size(); i != e; i++) { + const AvailabilityAttr *AA = dyn_cast<AvailabilityAttr>(Attrs[i]); if (!AA) continue; - // availability attribute info. - + + // 'availability' attribute. Result << "<Availability"; - StringRef distribution; + StringRef Distribution; if (AA->getPlatform()) { - distribution = AA->getPlatform()->getName(); - if (distribution == "macosx") - distribution = "OSX"; - else - distribution = "iOS"; + Distribution = AvailabilityAttr::getPrettyPlatformName( + AA->getPlatform()->getName()); + if (Distribution.empty()) + Distribution = AA->getPlatform()->getName(); } - - Result << " distribution=\""; - Result << distribution; - Result << "\">"; + Result << " distribution=\"" << Distribution << "\">"; VersionTuple IntroducedInVersion = AA->getIntroduced(); if (!IntroducedInVersion.empty()) { - Result << " <IntroducedInVersion>"; - Result << IntroducedInVersion.getAsString(); - Result << "</IntroducedInVersion>"; + Result << "<IntroducedInVersion>" + << IntroducedInVersion.getAsString() + << "</IntroducedInVersion>"; } VersionTuple DeprecatedInVersion = AA->getDeprecated(); if (!DeprecatedInVersion.empty()) { - Result << " <DeprecatedInVersion>"; - Result << DeprecatedInVersion.getAsString(); - Result << "</DeprecatedInVersion>"; + Result << "<DeprecatedInVersion>" + << DeprecatedInVersion.getAsString() + << "</DeprecatedInVersion>"; } VersionTuple RemovedAfterVersion = AA->getObsoleted(); if (!RemovedAfterVersion.empty()) { - Result << " <RemovedAfterVersion>"; - Result << RemovedAfterVersion.getAsString(); - Result << "</RemovedAfterVersion>"; + Result << "<RemovedAfterVersion>" + << RemovedAfterVersion.getAsString() + << "</RemovedAfterVersion>"; } + // 'deprecated' attribute. StringRef DeprecationSummary = AA->getMessage(); if (!DeprecationSummary.empty()) { - Result << " <DeprecationSummary>"; - Result << DeprecationSummary; - Result << "</DeprecationSummary>"; + Result << " <DeprecationSummary>" + << DeprecationSummary + << "</DeprecationSummary>"; } - Result << " <Unavailable>"; + // 'unavailable' attribute. if (AA->getUnavailable()) - Result << "true"; - else - Result << "false"; - Result << "</Unavailable>"; - Result << " </Availability>"; + Result << "<Unavailable>true</Unavailable>"; + Result << "</Availability>"; } } - + { bool StartTagEmitted = false; for (unsigned i = 0, e = Parts.MiscBlocks.size(); i != e; ++i) { |