mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix linkage of 'static inline' Clang-imported definitions
If an external SIL function has a Clang-generated body, I think this means we have a static function, and we want to use Shared linkage, not Public. Add a new flag to SILFunction for this and plumb it through to appease assertions from SILVerifier. Swift SVN r31763
This commit is contained in:
@@ -348,10 +348,14 @@ struct SILDeclRef {
|
||||
/// True if the referenced entity is some kind of thunk.
|
||||
bool isThunk() const;
|
||||
|
||||
/// True if the referenced entity is generated on behalf of the Clang
|
||||
/// True if the referenced entity is emitted by Swift on behalf of the Clang
|
||||
/// importer.
|
||||
bool isClangImported() const;
|
||||
|
||||
/// True if the referenced entity is emitted by Clang on behalf of the Clang
|
||||
/// importer.
|
||||
bool isClangGenerated() const;
|
||||
|
||||
bool isImplicit() const {
|
||||
if (hasDecl())
|
||||
return getDecl()->isImplicit();
|
||||
|
||||
@@ -120,11 +120,13 @@ private:
|
||||
/// The linkage of the function.
|
||||
unsigned Linkage : NumSILLinkageBits;
|
||||
|
||||
/// This flags indicates if a function can be
|
||||
/// eliminated by dead function elimination.
|
||||
/// If it is unset, DFE will preserve the function
|
||||
/// and make it public.
|
||||
unsigned KeepAsPublic: 1;
|
||||
/// This flag indicates if a function can be eliminated by dead function
|
||||
/// elimination. If it is unset, DFE will preserve the function and make
|
||||
/// it public.
|
||||
unsigned KeepAsPublic : 1;
|
||||
|
||||
/// This flag indicates if a function has a body generated by Clang.
|
||||
unsigned ForeignBody : 1;
|
||||
|
||||
/// This is the number of uses of this SILFunction inside the SIL.
|
||||
/// It does not include references from debug scopes.
|
||||
@@ -421,6 +423,10 @@ public:
|
||||
bool isKeepAsPublic() const { return KeepAsPublic; }
|
||||
void setKeepAsPublic(bool keep) { KeepAsPublic = keep; }
|
||||
|
||||
/// Get this function's foreign body attribute.
|
||||
HasForeignBody_t hasForeignBody() const { return HasForeignBody_t(ForeignBody); }
|
||||
void setForeignBody(HasForeignBody_t foreign) { ForeignBody = foreign; }
|
||||
|
||||
/// Retrieve the generic parameter list containing the contextual archetypes
|
||||
/// of the function.
|
||||
///
|
||||
|
||||
@@ -84,12 +84,18 @@ enum {
|
||||
NumSILLinkageBits = 3
|
||||
};
|
||||
|
||||
/// Reslated to linkage: flag if a function or global variable is fragle.
|
||||
/// Related to linkage: flag if a function or global variable is fragile.
|
||||
enum IsFragile_t {
|
||||
IsNotFragile,
|
||||
IsFragile
|
||||
};
|
||||
|
||||
|
||||
/// True if we have an inline body generated by Clang.
|
||||
enum HasForeignBody_t {
|
||||
DoesNotHaveForeignBody,
|
||||
HasForeignBody
|
||||
};
|
||||
|
||||
/// Strip external from public_external, hidden_external. Otherwise just return
|
||||
/// the linkage.
|
||||
inline SILLinkage stripExternalFromLinkage(SILLinkage linkage) {
|
||||
|
||||
Reference in New Issue
Block a user