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 | c491c3f27aabda38ff269c36c4de144b6905170b (patch) | |
tree | d1b6f2cd5216d2cad8b50ac7c4737afb44142719 /clang/tools/libclang/CXComment.cpp | |
parent | 3c837abd2bd0ed818f7a9b0fb18f7b5b35567ea9 (diff) | |
download | bcm5719-llvm-c491c3f27aabda38ff269c36c4de144b6905170b.tar.gz bcm5719-llvm-c491c3f27aabda38ff269c36c4de144b6905170b.zip |
availability in structured documents. Takes
care of comments by Dimitri and Doug.
llvm-svn: 164957
Diffstat (limited to 'clang/tools/libclang/CXComment.cpp')
-rw-r--r-- | clang/tools/libclang/CXComment.cpp | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/clang/tools/libclang/CXComment.cpp b/clang/tools/libclang/CXComment.cpp index a132a0d1baf..1e0679f22a6 100644 --- a/clang/tools/libclang/CXComment.cpp +++ b/clang/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) { |