mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
We would previously hide the protocol, its extensions and members, but the '_' prefix really just means the protocol itself isn't intended for clients, rather than its members. This also adds support for 'fully_annotated_decl' entries in doc-info for extensions to be consistent with every other decl, and removes the 'fully_annotated_generic_signature' entry we supplied as a fallback. Also fixes several bugs with the synthesized extensions mechanism: - The type sustitutions applied to the extension's requirements were computed using the extension itself as the decl context rather than the extension's nominal. The meant the extension's requirements themselves were assumed to hold when determining the substitutions, so equality constraints were always met. Because of this extension members were incorrectly merged with the base nominal or its extensions despite having additional constraints. - Types within the requirements weren't being transformed when printed (e.g. 'Self.Element' was printed rather than 'T') both in the interface output and in the requirements list. We were also incorrectly printing requirements that were already satisfied once the base type was subsituted in. - If both the protocol extension and 'enabling' extension of the base nominal that added the protocol conformance had conditional requirements, we were only printing the protocol extension's requirements in the synthesized extension. - The USR and annotated decl output embedded in the 'key.doc.full_as_xml' string for synthesized members were printed to match their original context, rather than the synthesized one. Resolves rdar://problem/57121937
53 lines
1.7 KiB
C++
53 lines
1.7 KiB
C++
//===--- CommentConversion.h - Conversion of comments to other formats ----===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_IDE_COMMENT_CONVERSION_H
|
|
#define SWIFT_IDE_COMMENT_CONVERSION_H
|
|
|
|
#include "swift/Basic/LLVM.h"
|
|
#include "swift/AST/TypeOrExtensionDecl.h"
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
namespace swift {
|
|
class Decl;
|
|
class DocComment;
|
|
|
|
namespace ide {
|
|
|
|
/// If the declaration has a documentation comment, prints the comment to \p OS
|
|
/// in Clang-like XML format.
|
|
///
|
|
/// \returns true if the declaration has a documentation comment.
|
|
bool getDocumentationCommentAsXML(
|
|
const Decl *D, raw_ostream &OS,
|
|
TypeOrExtensionDecl SynthesizedTarget = TypeOrExtensionDecl());
|
|
|
|
/// If the declaration has a documentation comment and a localization key,
|
|
/// print it into the given output stream and return true. Else, return false.
|
|
bool getLocalizationKey(const Decl *D, raw_ostream &OS);
|
|
|
|
/// Converts the given comment to Doxygen.
|
|
void getDocumentationCommentAsDoxygen(const DocComment *DC, raw_ostream &OS);
|
|
|
|
/// Extract and normalize text from the given comment.
|
|
std::string extractPlainTextFromComment(const StringRef Text);
|
|
|
|
/// Given the raw text in markup format, convert its content to xml.
|
|
bool convertMarkupToXML(StringRef Text, raw_ostream &OS);
|
|
|
|
} // namespace ide
|
|
} // namespace swift
|
|
|
|
#endif // SWIFT_IDE_COMMENT_CONVERSION_H
|
|
|