@@ -100,24 +100,23 @@ getAllMovedPlatformVersions(Decl *D) {
100100 return Results;
101101}
102102
103- static StringRef getLinkerPlatformName (uint8_t Id) {
103+ static StringRef getLinkerPlatformName (LinkerPlatformId Id) {
104104 switch (Id) {
105- #define LD_PLATFORM (Name, Id ) case Id : return #Name;
105+ #define LD_PLATFORM (Name, Id ) case LinkerPlatformId::Name : return #Name;
106106#include " ldPlatformKinds.def"
107- default :
108- llvm_unreachable (" unrecognized platform id" );
109107 }
108+ llvm_unreachable (" unrecognized platform id" );
110109}
111110
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 )
115114#include " ldPlatformKinds.def"
116115 .Default (std::nullopt );
117116}
118117
119118StringRef InstallNameStore::getInstallName (LinkerPlatformId Id) const {
120- auto It = PlatformInstallName.find (( uint8_t ) Id);
119+ auto It = PlatformInstallName.find (Id);
121120 if (It == PlatformInstallName.end ())
122121 return InstallName;
123122 else
@@ -129,8 +128,9 @@ static std::string getScalaNodeText(Node *N) {
129128 return cast<ScalarNode>(N)->getValue (Buffer).str ();
130129}
131130
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;
134134 for (auto &E: *cast<SequenceNode>(N)) {
135135 auto Platform = getScalaNodeText (&E);
136136 auto Id = getLinkerPlatformId (Platform);
@@ -158,7 +158,7 @@ parseEntry(ASTContext &Ctx,
158158 auto *MN = cast<MappingNode>(&*It);
159159 std::string ModuleName;
160160 std::string InstallName;
161- std::optional<std::set<int8_t >> Platforms;
161+ std::optional<std::set<LinkerPlatformId >> Platforms;
162162 for (auto &Pair: *MN) {
163163 auto Key = getScalaNodeText (Pair.getKey ());
164164 auto * Value = Pair.getValue ();
@@ -333,7 +333,7 @@ void TBDGenVisitor::addLinkerDirectiveSymbolsLdPrevious(
333333 OS << " $ld$previous$" ;
334334 OS << InstallName << " $" ;
335335 OS << ComptibleVersion << " $" ;
336- OS << std::to_string (( uint8_t ) PlatformNumber) << " $" ;
336+ OS << std::to_string (static_cast < uint8_t >( PlatformNumber) ) << " $" ;
337337 static auto getMinor = [](std::optional<unsigned > Minor) {
338338 return Minor.has_value () ? *Minor : 0 ;
339339 };
0 commit comments