Skip to content

Commit 46a315e

Browse files
authored
Merge pull request #32645 from davezarzycki/pr32645
NFC: Make SILType.h and SILDeclRef.h not depend on SIL/*.h
2 parents b9341c8 + fae2c19 commit 46a315e

File tree

14 files changed

+39
-30
lines changed

14 files changed

+39
-30
lines changed

include/swift/AST/Types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "swift/AST/Ownership.h"
2525
#include "swift/AST/ProtocolConformanceRef.h"
2626
#include "swift/AST/Requirement.h"
27-
#include "swift/AST/SILLayout.h"
2827
#include "swift/AST/SubstitutionMap.h"
2928
#include "swift/AST/Type.h"
3029
#include "swift/AST/TypeAlignments.h"

include/swift/SIL/SILDeclRef.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
#include "swift/AST/ClangNode.h"
2323
#include "swift/AST/TypeAlignments.h"
24-
#include "swift/SIL/SILLinkage.h"
2524
#include "llvm/ADT/Hashing.h"
2625
#include "llvm/ADT/DenseMap.h"
2726
#include "llvm/ADT/PointerUnion.h"
@@ -47,6 +46,7 @@ namespace swift {
4746
enum class SubclassScope : unsigned char;
4847
class SILModule;
4948
class SILLocation;
49+
enum class SILLinkage : uint8_t;
5050
class AnyFunctionRef;
5151

5252
/// How a method is dispatched.
@@ -423,22 +423,6 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, SILDeclRef C) {
423423
return OS;
424424
}
425425

426-
// FIXME: This should not be necessary, but it looks like visibility rules for
427-
// extension members are slightly bogus, and so some protocol witness thunks
428-
// need to be public.
429-
//
430-
// We allow a 'public' member of an extension to witness a public
431-
// protocol requirement, even if the extended type is not public;
432-
// then SILGen gives the member private linkage, ignoring the more
433-
// visible access level it was given in the AST.
434-
inline bool
435-
fixmeWitnessHasLinkageThatNeedsToBePublic(SILDeclRef witness) {
436-
auto witnessLinkage = witness.getLinkage(ForDefinition);
437-
return !hasPublicVisibility(witnessLinkage)
438-
&& (!hasSharedVisibility(witnessLinkage)
439-
|| !witness.isSerialized());
440-
}
441-
442426
} // end swift namespace
443427

444428
namespace llvm {

include/swift/SIL/SILLinkage.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
#include "llvm/Support/ErrorHandling.h"
1717

18+
// FIXME: Remove after fixmeWitnessHasLinkageThatNeedsToBePublic is removed.
19+
#include "swift/SIL/SILDeclRef.h"
20+
1821
namespace swift {
1922

2023
class ValueDecl;
@@ -265,6 +268,22 @@ inline SILLinkage effectiveLinkageForClassMember(SILLinkage linkage,
265268
return linkage;
266269
}
267270

271+
// FIXME: This should not be necessary, but it looks like visibility rules for
272+
// extension members are slightly bogus, and so some protocol witness thunks
273+
// need to be public.
274+
//
275+
// We allow a 'public' member of an extension to witness a public
276+
// protocol requirement, even if the extended type is not public;
277+
// then SILGen gives the member private linkage, ignoring the more
278+
// visible access level it was given in the AST.
279+
inline bool
280+
fixmeWitnessHasLinkageThatNeedsToBePublic(SILDeclRef witness) {
281+
auto witnessLinkage = witness.getLinkage(ForDefinition);
282+
return !hasPublicVisibility(witnessLinkage)
283+
&& (!hasSharedVisibility(witnessLinkage)
284+
|| !witness.isSerialized());
285+
}
286+
268287
} // end swift namespace
269288

270289
#endif

include/swift/SIL/SILType.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@
1919
#define SWIFT_SIL_SILTYPE_H
2020

2121
#include "swift/AST/CanTypeVisitor.h"
22+
#include "swift/AST/SILLayout.h"
2223
#include "swift/AST/Types.h"
2324
#include "llvm/ADT/PointerIntPair.h"
2425
#include "llvm/Support/ErrorHandling.h"
25-
#include "swift/SIL/SILAllocated.h"
26-
#include "swift/SIL/SILArgumentConvention.h"
2726
#include "llvm/ADT/Hashing.h"
28-
#include "swift/SIL/SILDeclRef.h"
2927

3028
namespace swift {
3129

@@ -628,14 +626,6 @@ NON_SIL_TYPE(AnyFunction)
628626
NON_SIL_TYPE(LValue)
629627
#undef NON_SIL_TYPE
630628

631-
CanSILFunctionType getNativeSILFunctionType(
632-
Lowering::TypeConverter &TC, TypeExpansionContext context,
633-
Lowering::AbstractionPattern origType, CanAnyFunctionType substType,
634-
Optional<SILDeclRef> origConstant = None,
635-
Optional<SILDeclRef> constant = None,
636-
Optional<SubstitutionMap> reqtSubs = None,
637-
ProtocolConformanceRef witnessMethodConformance = ProtocolConformanceRef());
638-
639629
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, SILType T) {
640630
T.print(OS);
641631
return OS;

include/swift/SIL/SILValue.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include "swift/Basic/Range.h"
2121
#include "swift/Basic/ArrayRefView.h"
2222
#include "swift/Basic/STLExtras.h"
23+
#include "swift/SIL/SILAllocated.h"
24+
#include "swift/SIL/SILArgumentConvention.h"
2325
#include "swift/SIL/SILNode.h"
2426
#include "swift/SIL/SILType.h"
2527
#include "llvm/ADT/ArrayRef.h"

include/swift/SIL/TypeLowering.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,15 @@ class TypeConverter {
10951095
};
10961096

10971097
} // namespace Lowering
1098+
1099+
CanSILFunctionType getNativeSILFunctionType(
1100+
Lowering::TypeConverter &TC, TypeExpansionContext context,
1101+
Lowering::AbstractionPattern origType, CanAnyFunctionType substType,
1102+
Optional<SILDeclRef> origConstant = None,
1103+
Optional<SILDeclRef> constant = None,
1104+
Optional<SubstitutionMap> reqtSubs = None,
1105+
ProtocolConformanceRef witnessMethodConformance = ProtocolConformanceRef());
1106+
10981107
} // namespace swift
10991108

11001109
namespace llvm {

lib/AST/ASTMangler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "swift/AST/PrettyStackTrace.h"
2929
#include "swift/AST/ProtocolConformance.h"
3030
#include "swift/AST/ProtocolConformanceRef.h"
31+
#include "swift/AST/SILLayout.h"
3132
#include "swift/Basic/Defer.h"
3233
#include "swift/Demangling/ManglingMacros.h"
3334
#include "swift/Demangling/ManglingUtils.h"

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "swift/AST/ParameterList.h"
3131
#include "swift/AST/PrintOptions.h"
3232
#include "swift/AST/ProtocolConformance.h"
33+
#include "swift/AST/SILLayout.h"
3334
#include "swift/AST/Stmt.h"
3435
#include "swift/AST/TypeVisitor.h"
3536
#include "swift/AST/TypeWalker.h"

lib/AST/Type.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "swift/AST/Module.h"
3030
#include "swift/AST/ParameterList.h"
3131
#include "swift/AST/ProtocolConformance.h"
32+
#include "swift/AST/SILLayout.h"
3233
#include "swift/AST/SubstitutionMap.h"
3334
#include "swift/AST/TypeLoc.h"
3435
#include "swift/AST/TypeRepr.h"

lib/Basic/Statistic.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "swift/Basic/Timer.h"
1818
#include "swift/AST/Decl.h"
1919
#include "swift/AST/Expr.h"
20-
#include "swift/SIL/SILFunction.h"
2120
#include "llvm/ADT/DenseMap.h"
2221
#include "llvm/Config/config.h"
2322
#include "llvm/Support/FileSystem.h"

lib/IRGen/GenObjC.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef SWIFT_IRGEN_GENOBJC_H
1818
#define SWIFT_IRGEN_GENOBJC_H
1919

20+
#include "swift/SIL/SILDeclRef.h"
2021

2122
namespace llvm {
2223
class Type;

lib/Sema/TypeCheckType.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "swift/AST/ParameterList.h"
3434
#include "swift/AST/PrettyStackTrace.h"
3535
#include "swift/AST/ProtocolConformance.h"
36+
#include "swift/AST/SILLayout.h"
3637
#include "swift/AST/SourceFile.h"
3738
#include "swift/AST/TypeCheckRequests.h"
3839
#include "swift/AST/TypeLoc.h"

lib/Serialization/ModuleFile.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "swift/AST/FileUnit.h"
2121
#include "swift/AST/Module.h"
2222
#include "swift/AST/RawComment.h"
23+
#include "swift/AST/SILLayout.h"
2324
#include "swift/Serialization/Validation.h"
2425
#include "swift/Basic/LLVM.h"
2526
#include "clang/AST/Type.h"

lib/Serialization/Serialization.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "swift/AST/PropertyWrappers.h"
3232
#include "swift/AST/ProtocolConformance.h"
3333
#include "swift/AST/RawComment.h"
34+
#include "swift/AST/SILLayout.h"
3435
#include "swift/AST/SourceFile.h"
3536
#include "swift/AST/SynthesizedFileUnit.h"
3637
#include "swift/AST/TypeCheckRequests.h"

0 commit comments

Comments
 (0)