mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
- The overload of operator^ on FormalLinkage, while cute, was only used in this one place, and does not behave like an XOR. - The structural type walk was totally unnecessary in the first place, because we were only ever calling getTypeLinkage() with builtin types and nominal types. - Furthermore, the structural type walk was doing the wrong thing with nested nominal types, because the linkage of a nested type A.B should not be the intersection of the linkage of A and A.B. If A is an imported type and A.B is defined in an extension of A, we would give the metadata of A.B shared linkage, which is wrong.
63 lines
2.0 KiB
C++
63 lines
2.0 KiB
C++
//===--- FormalLinkage.h - Formal linkage of types and decls ----*- C++ -*-===//
|
|
//
|
|
// 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_SIL_FORMALLINKAGE_H
|
|
#define SWIFT_SIL_FORMALLINKAGE_H
|
|
|
|
namespace swift {
|
|
|
|
class CanType;
|
|
class NormalProtocolConformance;
|
|
class ValueDecl;
|
|
enum class SILLinkage : unsigned char;
|
|
enum ForDefinition_t : bool;
|
|
|
|
/// Formal linkage is a property of types and declarations that
|
|
/// informs, but is not completely equivalent to, the linkage of
|
|
/// symbols corresponding to those types and declarations.
|
|
///
|
|
/// Forms a semilattice with ^ as the meet operator.
|
|
enum class FormalLinkage {
|
|
/// This entity is visible in multiple Swift modules and has a
|
|
/// unique file that is known to define it.
|
|
PublicUnique,
|
|
|
|
/// This entity is visible in multiple Swift modules, but does not
|
|
/// have a unique file that is known to define it.
|
|
PublicNonUnique,
|
|
|
|
/// This entity is visible in only a single Swift module and has a
|
|
/// unique file that is known to define it.
|
|
HiddenUnique,
|
|
|
|
/// This entity is visible in only a single Swift module but does not
|
|
/// have a unique file that is known to define it.
|
|
HiddenNonUnique,
|
|
|
|
/// This entity is visible in only a single Swift file.
|
|
//
|
|
// In reality, these are by definition unique, but we use the
|
|
// non-unique flag to make merging more efficient.
|
|
Private,
|
|
};
|
|
|
|
FormalLinkage getDeclLinkage(const ValueDecl *decl);
|
|
SILLinkage getSILLinkage(FormalLinkage linkage,
|
|
ForDefinition_t forDefinition);
|
|
SILLinkage
|
|
getLinkageForProtocolConformance(const NormalProtocolConformance *C,
|
|
ForDefinition_t definition);
|
|
|
|
} // end swift namespace
|
|
|
|
#endif
|