@@ -100,24 +100,23 @@ getAllMovedPlatformVersions(Decl *D) {
100
100
return Results;
101
101
}
102
102
103
- static StringRef getLinkerPlatformName (uint8_t Id) {
103
+ static StringRef getLinkerPlatformName (LinkerPlatformId Id) {
104
104
switch (Id) {
105
- #define LD_PLATFORM (Name, Id ) case Id : return #Name;
105
+ #define LD_PLATFORM (Name, Id ) case LinkerPlatformId::Name : return #Name;
106
106
#include " ldPlatformKinds.def"
107
- default :
108
- llvm_unreachable (" unrecognized platform id" );
109
107
}
108
+ llvm_unreachable (" unrecognized platform id" );
110
109
}
111
110
112
- static std::optional<uint8_t > getLinkerPlatformId (StringRef Platform) {
113
- return llvm::StringSwitch<std::optional<uint8_t >>(Platform)
114
- #define LD_PLATFORM (Name, Id ) .Case(#Name, Id )
111
+ static std::optional<LinkerPlatformId > getLinkerPlatformId (StringRef Platform) {
112
+ return llvm::StringSwitch<std::optional<LinkerPlatformId >>(Platform)
113
+ #define LD_PLATFORM (Name, Id ) .Case(#Name, LinkerPlatformId::Name )
115
114
#include " ldPlatformKinds.def"
116
115
.Default (std::nullopt);
117
116
}
118
117
119
118
StringRef InstallNameStore::getInstallName (LinkerPlatformId Id) const {
120
- auto It = PlatformInstallName.find (( uint8_t ) Id);
119
+ auto It = PlatformInstallName.find (Id);
121
120
if (It == PlatformInstallName.end ())
122
121
return InstallName;
123
122
else
@@ -129,8 +128,9 @@ static std::string getScalaNodeText(Node *N) {
129
128
return cast<ScalarNode>(N)->getValue (Buffer).str ();
130
129
}
131
130
132
- static std::set<int8_t > getSequenceNodePlatformList (ASTContext &Ctx, Node *N) {
133
- std::set<int8_t > Results;
131
+ static std::set<LinkerPlatformId> getSequenceNodePlatformList (ASTContext &Ctx,
132
+ Node *N) {
133
+ std::set<LinkerPlatformId> Results;
134
134
for (auto &E: *cast<SequenceNode>(N)) {
135
135
auto Platform = getScalaNodeText (&E);
136
136
auto Id = getLinkerPlatformId (Platform);
@@ -158,7 +158,7 @@ parseEntry(ASTContext &Ctx,
158
158
auto *MN = cast<MappingNode>(&*It);
159
159
std::string ModuleName;
160
160
std::string InstallName;
161
- std::optional<std::set<int8_t >> Platforms;
161
+ std::optional<std::set<LinkerPlatformId >> Platforms;
162
162
for (auto &Pair: *MN) {
163
163
auto Key = getScalaNodeText (Pair.getKey ());
164
164
auto * Value = Pair.getValue ();
@@ -333,7 +333,7 @@ void TBDGenVisitor::addLinkerDirectiveSymbolsLdPrevious(
333
333
OS << " $ld$previous$" ;
334
334
OS << InstallName << " $" ;
335
335
OS << ComptibleVersion << " $" ;
336
- OS << std::to_string (( uint8_t ) PlatformNumber) << " $" ;
336
+ OS << std::to_string (static_cast < uint8_t >( PlatformNumber) ) << " $" ;
337
337
static auto getMinor = [](std::optional<unsigned > Minor) {
338
338
return Minor.has_value () ? *Minor : 0 ;
339
339
};
0 commit comments