コード例 #1
0
static void printFullyAnnotatedDeclaration(const ValueDecl *VD, const Type Ty,
                                           const Type BaseTy, raw_ostream &OS) {
  FullyAnnotatedDeclarationPrinter Printer(OS);
  PrintOptions PO = PrintOptions::printQuickHelpDeclaration();
  if (BaseTy)
    PO.setArchetypeTransformForQuickHelp(BaseTy, VD->getDeclContext());

  // If it's implicit, try to find an overridden ValueDecl that's not implicit.
  // This will ensure we can properly annotate TypeRepr with a usr
  // in AnnotatedDeclarationPrinter.
  while (VD->isImplicit() && VD->getOverriddenDecl())
    VD = VD->getOverriddenDecl();

  VD->print(Printer, PO);
}
コード例 #2
0
ファイル: SwiftSourceDocInfo.cpp プロジェクト: arbales/swift
static void printAnnotatedDeclaration(const ValueDecl *VD, const Type Ty,
                                      const Type BaseTy,
                                      raw_ostream &OS) {
  AnnotatedDeclarationPrinter Printer(OS);
  PrintOptions PO = PrintOptions::printQuickHelpDeclaration();
  if (BaseTy)
    PO.setArchetypeTransformForQuickHelp(BaseTy, VD->getDeclContext());

  // If it's implicit, try to find an overridden ValueDecl that's not implicit.
  // This will ensure we can properly annotate TypeRepr with a usr
  // in AnnotatedDeclarationPrinter.
  while (VD->isImplicit() && VD->getOverriddenDecl())
    VD = VD->getOverriddenDecl();

  // Wrap this up in XML, as that's what we'll use for documentation comments.
  OS<<"<Declaration>";
  VD->print(Printer, PO);
  OS<<"</Declaration>";
}