@@ -61,21 +61,21 @@ using namespace swift::irgen;
61
61
using namespace swift ::tbdgen;
62
62
using namespace llvm ::yaml;
63
63
using StringSet = llvm::StringSet<>;
64
- using SymbolKind = llvm::MachO::SymbolKind ;
64
+ using EncodeKind = llvm::MachO::EncodeKind ;
65
65
using SymbolFlags = llvm::MachO::SymbolFlags;
66
66
67
67
TBDGenVisitor::TBDGenVisitor (const TBDGenDescriptor &desc,
68
68
APIRecorder &recorder)
69
69
: TBDGenVisitor(desc.getTarget(), desc.getDataLayoutString(),
70
70
desc.getParentModule(), desc.getOptions(), recorder) {}
71
71
72
- void TBDGenVisitor::addSymbolInternal (StringRef name, SymbolKind kind,
72
+ void TBDGenVisitor::addSymbolInternal (StringRef name, EncodeKind kind,
73
73
SymbolSource source, SymbolFlags flags) {
74
74
if (!source.isLinkerDirective () && Opts.LinkerDirectivesOnly )
75
75
return ;
76
76
77
77
#ifndef NDEBUG
78
- if (kind == SymbolKind ::GlobalSymbol) {
78
+ if (kind == EncodeKind ::GlobalSymbol) {
79
79
if (!DuplicateSymbolChecker.insert (name).second ) {
80
80
llvm::dbgs () << " TBDGen duplicate symbol: " << name << ' \n ' ;
81
81
assert (false && " TBDGen symbol appears twice" );
@@ -291,9 +291,9 @@ static llvm::VersionTuple calculateLdPreviousVersionStart(ASTContext &ctx,
291
291
return introVer;
292
292
}
293
293
294
- void TBDGenVisitor::addLinkerDirectiveSymbolsLdPrevious (StringRef name,
295
- llvm::MachO::SymbolKind kind) {
296
- if (kind != llvm::MachO::SymbolKind ::GlobalSymbol)
294
+ void TBDGenVisitor::addLinkerDirectiveSymbolsLdPrevious (
295
+ StringRef name, llvm::MachO::EncodeKind kind) {
296
+ if (kind != llvm::MachO::EncodeKind ::GlobalSymbol)
297
297
return ;
298
298
if (DeclStack.empty ())
299
299
return ;
@@ -341,14 +341,14 @@ void TBDGenVisitor::addLinkerDirectiveSymbolsLdPrevious(StringRef name,
341
341
OS << verStart.getMajor () << " ." << getMinor (verStart.getMinor ()) << " $" ;
342
342
OS << Ver.Version .getMajor () << " ." << getMinor (Ver.Version .getMinor ()) << " $" ;
343
343
OS << name << " $" ;
344
- addSymbolInternal (OS.str (), SymbolKind ::GlobalSymbol,
344
+ addSymbolInternal (OS.str (), EncodeKind ::GlobalSymbol,
345
345
SymbolSource::forLinkerDirective (), SymbolFlags::Data);
346
346
}
347
347
}
348
348
349
- void TBDGenVisitor::addLinkerDirectiveSymbolsLdHide (StringRef name,
350
- llvm::MachO::SymbolKind kind) {
351
- if (kind != llvm::MachO::SymbolKind ::GlobalSymbol)
349
+ void TBDGenVisitor::addLinkerDirectiveSymbolsLdHide (
350
+ StringRef name, llvm::MachO::EncodeKind kind) {
351
+ if (kind != llvm::MachO::EncodeKind ::GlobalSymbol)
352
352
return ;
353
353
if (DeclStack.empty ())
354
354
return ;
@@ -387,19 +387,19 @@ void TBDGenVisitor::addLinkerDirectiveSymbolsLdHide(StringRef name,
387
387
llvm::SmallString<64 > Buffer;
388
388
llvm::raw_svector_ostream OS (Buffer);
389
389
OS << " $ld$hide$os" << CurMaj << " ." << CurMin << " $" << name;
390
- addSymbolInternal (OS.str (), SymbolKind ::GlobalSymbol,
390
+ addSymbolInternal (OS.str (), EncodeKind ::GlobalSymbol,
391
391
SymbolSource::forLinkerDirective (), SymbolFlags::Data);
392
392
}
393
393
}
394
394
}
395
395
396
396
void TBDGenVisitor::addSymbol (StringRef name, SymbolSource source,
397
- SymbolFlags flags, SymbolKind kind) {
397
+ SymbolFlags flags, EncodeKind kind) {
398
398
// The linker expects to see mangled symbol names in TBD files,
399
399
// except when being passed objective c classes,
400
400
// so make sure to mangle before inserting the symbol.
401
401
SmallString<32 > mangled;
402
- if (kind == SymbolKind ::ObjectiveCClass) {
402
+ if (kind == EncodeKind ::ObjectiveCClass) {
403
403
mangled = name;
404
404
} else {
405
405
if (!DataLayout)
@@ -461,7 +461,7 @@ void TBDGenVisitor::addObjCInterface(ClassDecl *CD) {
461
461
// FIXME: We ought to have a symbol source for this.
462
462
SmallString<128 > buffer;
463
463
addSymbol (CD->getObjCRuntimeName (buffer), SymbolSource::forUnknown (),
464
- SymbolFlags::Data, SymbolKind ::ObjectiveCClass);
464
+ SymbolFlags::Data, EncodeKind ::ObjectiveCClass);
465
465
recorder.addObjCInterface (CD);
466
466
}
467
467
@@ -619,7 +619,7 @@ TBDFile GenerateTBDRequest::evaluate(Evaluator &evaluator,
619
619
targets.push_back (targetVar);
620
620
}
621
621
622
- auto addSymbol = [&](StringRef symbol, SymbolKind kind, SymbolSource source,
622
+ auto addSymbol = [&](StringRef symbol, EncodeKind kind, SymbolSource source,
623
623
Decl *decl, SymbolFlags flags) {
624
624
file.addSymbol (kind, symbol, targets, flags);
625
625
};
@@ -633,12 +633,12 @@ std::vector<std::string>
633
633
PublicSymbolsRequest::evaluate (Evaluator &evaluator,
634
634
TBDGenDescriptor desc) const {
635
635
std::vector<std::string> symbols;
636
- auto addSymbol = [&](StringRef symbol, SymbolKind kind, SymbolSource source,
636
+ auto addSymbol = [&](StringRef symbol, EncodeKind kind, SymbolSource source,
637
637
Decl *decl, SymbolFlags flags) {
638
- if (kind == SymbolKind ::GlobalSymbol)
638
+ if (kind == EncodeKind ::GlobalSymbol)
639
639
symbols.push_back (symbol.str ());
640
640
// TextAPI ObjC Class Kinds represents two symbols.
641
- else if (kind == SymbolKind ::ObjectiveCClass) {
641
+ else if (kind == EncodeKind ::ObjectiveCClass) {
642
642
symbols.push_back ((llvm::MachO::ObjC2ClassNamePrefix + symbol).str ());
643
643
symbols.push_back ((llvm::MachO::ObjC2MetaClassNamePrefix + symbol).str ());
644
644
}
@@ -681,9 +681,9 @@ class APIGenRecorder final : public APIRecorder {
681
681
}
682
682
~APIGenRecorder () {}
683
683
684
- void addSymbol (StringRef symbol, SymbolKind kind, SymbolSource source,
684
+ void addSymbol (StringRef symbol, EncodeKind kind, SymbolSource source,
685
685
Decl *decl, SymbolFlags flags) override {
686
- if (kind != SymbolKind ::GlobalSymbol)
686
+ if (kind != EncodeKind ::GlobalSymbol)
687
687
return ;
688
688
689
689
apigen::APIAvailability availability;
@@ -885,7 +885,7 @@ SymbolSourceMapRequest::evaluate(Evaluator &evaluator,
885
885
auto &Ctx = desc.getParentModule ()->getASTContext ();
886
886
auto *SymbolSources = Ctx.Allocate <SymbolSourceMap>();
887
887
888
- auto addSymbol = [=](StringRef symbol, SymbolKind kind, SymbolSource source,
888
+ auto addSymbol = [=](StringRef symbol, EncodeKind kind, SymbolSource source,
889
889
Decl *decl, SymbolFlags flags) {
890
890
SymbolSources->insert ({symbol, source});
891
891
};
0 commit comments