27
27
#include " llvm/ADT/StringSet.h"
28
28
29
29
using namespace swift ;
30
+ using namespace swift ::irgen;
30
31
using StringSet = llvm::StringSet<>;
31
32
32
33
static bool isPrivateDecl (ValueDecl *VD) {
@@ -36,7 +37,7 @@ static bool isPrivateDecl(ValueDecl *VD) {
36
37
namespace {
37
38
class TBDGenVisitor : public ASTVisitor <TBDGenVisitor> {
38
39
StringSet &Symbols;
39
- const irgen:: UniversalLinkageInfo &UniversalLinkInfo;
40
+ const UniversalLinkageInfo &UniversalLinkInfo;
40
41
ModuleDecl *SwiftModule;
41
42
42
43
void addSymbol (StringRef name) {
@@ -45,9 +46,9 @@ class TBDGenVisitor : public ASTVisitor<TBDGenVisitor> {
45
46
assert (isNewValue && " already inserted" );
46
47
}
47
48
48
- void addSymbol (irgen:: LinkEntity entity) {
49
- auto linkage = irgen::LinkInfo::get (UniversalLinkInfo, SwiftModule, entity,
50
- ForDefinition);
49
+ void addSymbol (LinkEntity entity) {
50
+ auto linkage =
51
+ LinkInfo::get (UniversalLinkInfo, SwiftModule, entity, ForDefinition);
51
52
52
53
auto externallyVisible =
53
54
llvm::GlobalValue::isExternalLinkage (linkage.getLinkage ()) &&
@@ -64,7 +65,7 @@ class TBDGenVisitor : public ASTVisitor<TBDGenVisitor> {
64
65
65
66
public:
66
67
TBDGenVisitor (StringSet &symbols,
67
- const irgen:: UniversalLinkageInfo &universalLinkInfo,
68
+ const UniversalLinkageInfo &universalLinkInfo,
68
69
ModuleDecl *swiftModule)
69
70
: Symbols(symbols), UniversalLinkInfo(universalLinkInfo),
70
71
SwiftModule (swiftModule) {}
@@ -99,12 +100,12 @@ class TBDGenVisitor : public ASTVisitor<TBDGenVisitor> {
99
100
void visitNominalTypeDecl (NominalTypeDecl *NTD) {
100
101
auto declaredType = NTD->getDeclaredType ()->getCanonicalType ();
101
102
102
- addSymbol (irgen:: LinkEntity::forNominalTypeDescriptor (NTD));
103
+ addSymbol (LinkEntity::forNominalTypeDescriptor (NTD));
103
104
104
- addSymbol (irgen:: LinkEntity::forTypeMetadata (
105
- declaredType, irgen:: TypeMetadataAddress::AddressPoint,
106
- /* isPattern=*/ false ));
107
- addSymbol (irgen:: LinkEntity::forTypeMetadataAccessFunction (declaredType));
105
+ addSymbol (LinkEntity::forTypeMetadata (declaredType,
106
+ TypeMetadataAddress::AddressPoint,
107
+ /* isPattern=*/ false ));
108
+ addSymbol (LinkEntity::forTypeMetadataAccessFunction (declaredType));
108
109
109
110
// There are symbols associated with any protocols this type conforms to.
110
111
for (auto conformance : NTD->getLocalConformances ()) {
@@ -113,9 +114,8 @@ class TBDGenVisitor : public ASTVisitor<TBDGenVisitor> {
113
114
if (!needsWTable)
114
115
continue ;
115
116
116
- addSymbol (irgen::LinkEntity::forDirectProtocolWitnessTable (conformance));
117
- addSymbol (irgen::LinkEntity::forProtocolWitnessTableAccessFunction (
118
- conformance));
117
+ addSymbol (LinkEntity::forDirectProtocolWitnessTable (conformance));
118
+ addSymbol (LinkEntity::forProtocolWitnessTableAccessFunction (conformance));
119
119
}
120
120
121
121
visitMembers (NTD);
@@ -127,7 +127,7 @@ class TBDGenVisitor : public ASTVisitor<TBDGenVisitor> {
127
127
void visitStructDecl (StructDecl *SD) { visitValueTypeDecl (SD); }
128
128
void visitEnumDecl (EnumDecl *ED) { visitValueTypeDecl (ED); }
129
129
void visitProtocolDecl (ProtocolDecl *PD) {
130
- addSymbol (irgen:: LinkEntity::forProtocolDescriptor (PD));
130
+ addSymbol (LinkEntity::forProtocolDescriptor (PD));
131
131
132
132
// There's no relevant information about members of a protocol at individual
133
133
// protocols, each conforming type has to handle them individually.
@@ -163,8 +163,8 @@ void TBDGenVisitor::visitVarDecl(VarDecl *VD) {
163
163
void swift::enumeratePublicSymbols (FileUnit *file, StringSet &symbols,
164
164
bool hasMultipleIRGenThreads,
165
165
bool isWholeModule) {
166
- irgen:: UniversalLinkageInfo linkInfo (file->getASTContext ().LangOpts .Target ,
167
- hasMultipleIRGenThreads, isWholeModule);
166
+ UniversalLinkageInfo linkInfo (file->getASTContext ().LangOpts .Target ,
167
+ hasMultipleIRGenThreads, isWholeModule);
168
168
169
169
SmallVector<Decl *, 16 > decls;
170
170
file->getTopLevelDecls (decls);
0 commit comments