コード例 #1
0
void TBDGenVisitor::addSymbol(SILDeclRef declRef, bool checkSILOnly) {
  bool isPrivate = !hasPublicVisibility(declRef.getLinkage(ForDefinition));
  // Even private methods of open classes (specifically, private methods that
  // are in the vtable) have public symbols, because external subclasses
  // currently need to refer to them by symbol for their own vtable.
  switch (declRef.getSubclassScope()) {
  case SubclassScope::External:
    // Allocating constructors retain their normal linkage behavior.
    if (declRef.kind == SILDeclRef::Kind::Allocator)
      break;

    // Unlike the "truly" public things, private things have public symbols
    // unconditionally, even if they're theoretically SIL only.
    if (isPrivate) {
      isPrivate = false;
      checkSILOnly = false;
    }
    break;
  case SubclassScope::Internal:
  case SubclassScope::NotApplicable:
    break;
  }
  if (isPrivate)
    return;

  // (Most) transparent things don't exist, even if they're public.
  // FIXME: isTransparent should really be "is SIL only".
  if (checkSILOnly && declRef.isTransparent())
    return;

  addSymbol(declRef.mangle());
}
コード例 #2
0
ファイル: TBDGen.cpp プロジェクト: d-ronnqvist/swift
void TBDGenVisitor::addSymbol(SILDeclRef declRef) {
  bool isPrivate = !hasPublicVisibility(declRef.getLinkage(ForDefinition));
  // Even private methods of open classes (specifically, private methods that
  // are in the vtable) have public symbols, because external subclasses
  // currently need to refer to them by symbol for their own vtable.
  switch (declRef.getSubclassScope()) {
  case SubclassScope::External:
    // Unlike the "truly" public things, private things have public symbols
    // unconditionally, even if they're theoretically SIL only.
    if (isPrivate) {
      isPrivate = false;
    }
    break;
  case SubclassScope::Internal:
  case SubclassScope::NotApplicable:
    break;
  }
  if (isPrivate)
    return;

  // FIXME: this includes too many symbols. There are some that are considered
  // SIL-only, but it isn't obvious how to determine this (e.g. it seems that
  // many, but not all, transparent functions result in object-file symbols)

  addSymbol(declRef.mangle());
}
コード例 #3
0
void TBDGenVisitor::addSymbol(SILDeclRef declRef) {
  auto linkage = effectiveLinkageForClassMember(
    declRef.getLinkage(ForDefinition),
    declRef.getSubclassScope());
  if (linkage == SILLinkage::Public)
    addSymbol(declRef.mangle());
}