Skip to content

Commit ec23b85

Browse files
committed
[TBDGen] update usages of MachO::SymbolKind -> MachO::EncodeKind, NFC
1 parent 701549f commit ec23b85

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

lib/IRGen/TBDGen.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,21 @@ using namespace swift::irgen;
6161
using namespace swift::tbdgen;
6262
using namespace llvm::yaml;
6363
using StringSet = llvm::StringSet<>;
64-
using SymbolKind = llvm::MachO::SymbolKind;
64+
using EncodeKind = llvm::MachO::EncodeKind;
6565
using SymbolFlags = llvm::MachO::SymbolFlags;
6666

6767
TBDGenVisitor::TBDGenVisitor(const TBDGenDescriptor &desc,
6868
APIRecorder &recorder)
6969
: TBDGenVisitor(desc.getTarget(), desc.getDataLayoutString(),
7070
desc.getParentModule(), desc.getOptions(), recorder) {}
7171

72-
void TBDGenVisitor::addSymbolInternal(StringRef name, SymbolKind kind,
72+
void TBDGenVisitor::addSymbolInternal(StringRef name, EncodeKind kind,
7373
SymbolSource source, SymbolFlags flags) {
7474
if (!source.isLinkerDirective() && Opts.LinkerDirectivesOnly)
7575
return;
7676

7777
#ifndef NDEBUG
78-
if (kind == SymbolKind::GlobalSymbol) {
78+
if (kind == EncodeKind::GlobalSymbol) {
7979
if (!DuplicateSymbolChecker.insert(name).second) {
8080
llvm::dbgs() << "TBDGen duplicate symbol: " << name << '\n';
8181
assert(false && "TBDGen symbol appears twice");
@@ -291,9 +291,9 @@ static llvm::VersionTuple calculateLdPreviousVersionStart(ASTContext &ctx,
291291
return introVer;
292292
}
293293

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)
297297
return;
298298
if(DeclStack.empty())
299299
return;
@@ -341,14 +341,14 @@ void TBDGenVisitor::addLinkerDirectiveSymbolsLdPrevious(StringRef name,
341341
OS << verStart.getMajor() << "." << getMinor(verStart.getMinor()) << "$";
342342
OS << Ver.Version.getMajor() << "." << getMinor(Ver.Version.getMinor()) << "$";
343343
OS << name << "$";
344-
addSymbolInternal(OS.str(), SymbolKind::GlobalSymbol,
344+
addSymbolInternal(OS.str(), EncodeKind::GlobalSymbol,
345345
SymbolSource::forLinkerDirective(), SymbolFlags::Data);
346346
}
347347
}
348348

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)
352352
return;
353353
if (DeclStack.empty())
354354
return;
@@ -387,19 +387,19 @@ void TBDGenVisitor::addLinkerDirectiveSymbolsLdHide(StringRef name,
387387
llvm::SmallString<64> Buffer;
388388
llvm::raw_svector_ostream OS(Buffer);
389389
OS << "$ld$hide$os" << CurMaj << "." << CurMin << "$" << name;
390-
addSymbolInternal(OS.str(), SymbolKind::GlobalSymbol,
390+
addSymbolInternal(OS.str(), EncodeKind::GlobalSymbol,
391391
SymbolSource::forLinkerDirective(), SymbolFlags::Data);
392392
}
393393
}
394394
}
395395

396396
void TBDGenVisitor::addSymbol(StringRef name, SymbolSource source,
397-
SymbolFlags flags, SymbolKind kind) {
397+
SymbolFlags flags, EncodeKind kind) {
398398
// The linker expects to see mangled symbol names in TBD files,
399399
// except when being passed objective c classes,
400400
// so make sure to mangle before inserting the symbol.
401401
SmallString<32> mangled;
402-
if (kind == SymbolKind::ObjectiveCClass) {
402+
if (kind == EncodeKind::ObjectiveCClass) {
403403
mangled = name;
404404
} else {
405405
if (!DataLayout)
@@ -461,7 +461,7 @@ void TBDGenVisitor::addObjCInterface(ClassDecl *CD) {
461461
// FIXME: We ought to have a symbol source for this.
462462
SmallString<128> buffer;
463463
addSymbol(CD->getObjCRuntimeName(buffer), SymbolSource::forUnknown(),
464-
SymbolFlags::Data, SymbolKind::ObjectiveCClass);
464+
SymbolFlags::Data, EncodeKind::ObjectiveCClass);
465465
recorder.addObjCInterface(CD);
466466
}
467467

@@ -619,7 +619,7 @@ TBDFile GenerateTBDRequest::evaluate(Evaluator &evaluator,
619619
targets.push_back(targetVar);
620620
}
621621

622-
auto addSymbol = [&](StringRef symbol, SymbolKind kind, SymbolSource source,
622+
auto addSymbol = [&](StringRef symbol, EncodeKind kind, SymbolSource source,
623623
Decl *decl, SymbolFlags flags) {
624624
file.addSymbol(kind, symbol, targets, flags);
625625
};
@@ -633,12 +633,12 @@ std::vector<std::string>
633633
PublicSymbolsRequest::evaluate(Evaluator &evaluator,
634634
TBDGenDescriptor desc) const {
635635
std::vector<std::string> symbols;
636-
auto addSymbol = [&](StringRef symbol, SymbolKind kind, SymbolSource source,
636+
auto addSymbol = [&](StringRef symbol, EncodeKind kind, SymbolSource source,
637637
Decl *decl, SymbolFlags flags) {
638-
if (kind == SymbolKind::GlobalSymbol)
638+
if (kind == EncodeKind::GlobalSymbol)
639639
symbols.push_back(symbol.str());
640640
// TextAPI ObjC Class Kinds represents two symbols.
641-
else if (kind == SymbolKind::ObjectiveCClass) {
641+
else if (kind == EncodeKind::ObjectiveCClass) {
642642
symbols.push_back((llvm::MachO::ObjC2ClassNamePrefix + symbol).str());
643643
symbols.push_back((llvm::MachO::ObjC2MetaClassNamePrefix + symbol).str());
644644
}
@@ -681,9 +681,9 @@ class APIGenRecorder final : public APIRecorder {
681681
}
682682
~APIGenRecorder() {}
683683

684-
void addSymbol(StringRef symbol, SymbolKind kind, SymbolSource source,
684+
void addSymbol(StringRef symbol, EncodeKind kind, SymbolSource source,
685685
Decl *decl, SymbolFlags flags) override {
686-
if (kind != SymbolKind::GlobalSymbol)
686+
if (kind != EncodeKind::GlobalSymbol)
687687
return;
688688

689689
apigen::APIAvailability availability;
@@ -885,7 +885,7 @@ SymbolSourceMapRequest::evaluate(Evaluator &evaluator,
885885
auto &Ctx = desc.getParentModule()->getASTContext();
886886
auto *SymbolSources = Ctx.Allocate<SymbolSourceMap>();
887887

888-
auto addSymbol = [=](StringRef symbol, SymbolKind kind, SymbolSource source,
888+
auto addSymbol = [=](StringRef symbol, EncodeKind kind, SymbolSource source,
889889
Decl *decl, SymbolFlags flags) {
890890
SymbolSources->insert({symbol, source});
891891
};

0 commit comments

Comments
 (0)