Skip to content

Commit

Permalink
IRGen: Weak-link opaque type entry points.
Browse files Browse the repository at this point in the history
When backward deploying to an OS that may not have these entry points, weak-link them so that they
can be used conditionally in availability contexts that check for them.

rdar://problem/50731151
  • Loading branch information
jckarter committed May 16, 2019
1 parent cec9e9e commit 2ade303
Show file tree
Hide file tree
Showing 8 changed files with 336 additions and 219 deletions.
4 changes: 4 additions & 0 deletions include/swift/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace clang {
namespace swift {
class ASTContext;
enum class Associativity : unsigned char;
class AvailabilityContext;
class BoundGenericType;
class ClangNode;
class ConstructorDecl;
Expand Down Expand Up @@ -584,6 +585,9 @@ class ASTContext final {
void addDestructorCleanup(T &object) {
addCleanup([&object]{ object.~T(); });
}

/// Get the runtime availability of the opaque types language feature for the target platform.
AvailabilityContext getOpaqueTypeAvailability();

//===--------------------------------------------------------------------===//
// Diagnostics Helper functions
Expand Down
3 changes: 3 additions & 0 deletions include/swift/Runtime/RuntimeFnWrappersGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "llvm/ADT/ArrayRef.h"

namespace swift {

class AvailabilityContext;

/// Generate an llvm declaration for a runtime entry with a
/// given name, return types, argument types, attributes and
Expand All @@ -28,6 +30,7 @@ llvm::Constant *getRuntimeFn(llvm::Module &Module,
llvm::Constant *&cache,
char const *name,
llvm::CallingConv::ID cc,
bool isWeakLinked,
llvm::ArrayRef<llvm::Type*> retTypes,
llvm::ArrayRef<llvm::Type*> argTypes,
llvm::ArrayRef<llvm::Attribute::AttrKind> attrs);
Expand Down
Loading

0 comments on commit 2ade303

Please sign in to comment.