mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Smaller values of FormalLinkage are actually wider scopes, so std::min'ing with PublicUnique actually just gives you a result that's always PublicUnique. And we need to start with PublicNonUnique because even things derived solely from uniquely-emitted types are not themselves generally unique. I don't want to immediately open the can of worms that fixing this for everyone would entail, so I'm just adding the new version in parallel and moving new clients to it gradually.
59 lines
2.0 KiB
C++
59 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 CanGenericSignature;
|
|
class CanType;
|
|
class RootProtocolConformance;
|
|
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.
|
|
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 file. These are by
|
|
/// definition unique.
|
|
Private,
|
|
};
|
|
|
|
FormalLinkage getDeclLinkage(const ValueDecl *decl);
|
|
FormalLinkage getTypeLinkage(CanType formalType);
|
|
FormalLinkage getTypeLinkage_correct(CanType formalType);
|
|
FormalLinkage getGenericSignatureLinkage(CanGenericSignature signature);
|
|
SILLinkage getSILLinkage(FormalLinkage linkage,
|
|
ForDefinition_t forDefinition);
|
|
SILLinkage
|
|
getLinkageForProtocolConformance(const RootProtocolConformance *C,
|
|
ForDefinition_t definition);
|
|
|
|
} // end swift namespace
|
|
|
|
#endif
|