Index: llvm/trunk/include/llvm/TextAPI/MachO/Architecture.h =================================================================== --- llvm/trunk/include/llvm/TextAPI/MachO/Architecture.h +++ llvm/trunk/include/llvm/TextAPI/MachO/Architecture.h @@ -20,11 +20,11 @@ namespace MachO { /// Defines the architecture slices that are supported by Text-based Stub files. -enum class Architecture : uint8_t { -#define ARCHINFO(Arch, Type, SubType) Arch, +enum Architecture : uint8_t { +#define ARCHINFO(Arch, Type, SubType) AK_##Arch, #include "llvm/TextAPI/MachO/Architecture.def" #undef ARCHINFO - unknown, // this has to go last. + AK_unknown, // this has to go last. }; /// Convert a CPU Type and Subtype pair to an architecture slice. Index: llvm/trunk/include/llvm/TextAPI/MachO/ArchitectureSet.h =================================================================== --- llvm/trunk/include/llvm/TextAPI/MachO/ArchitectureSet.h +++ llvm/trunk/include/llvm/TextAPI/MachO/ArchitectureSet.h @@ -38,7 +38,7 @@ ArchitectureSet(const std::vector &Archs); void set(Architecture Arch) { - if (Arch == Architecture::unknown) + if (Arch == AK_unknown) return; ArchSet |= 1U << static_cast(Arch); } Index: llvm/trunk/lib/TextAPI/MachO/Architecture.cpp =================================================================== --- llvm/trunk/lib/TextAPI/MachO/Architecture.cpp +++ llvm/trunk/lib/TextAPI/MachO/Architecture.cpp @@ -21,29 +21,29 @@ #define ARCHINFO(Arch, Type, Subtype) \ if (CPUType == (Type) && \ (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) == (Subtype)) \ - return Architecture::Arch; + return AK_##Arch; #include "llvm/TextAPI/MachO/Architecture.def" #undef ARCHINFO - return Architecture::unknown; + return AK_unknown; } Architecture getArchitectureFromName(StringRef Name) { return StringSwitch(Name) -#define ARCHINFO(Arch, Type, Subtype) .Case(#Arch, Architecture::Arch) +#define ARCHINFO(Arch, Type, Subtype) .Case(#Arch, AK_##Arch) #include "llvm/TextAPI/MachO/Architecture.def" #undef ARCHINFO - .Default(Architecture::unknown); + .Default(AK_unknown); } StringRef getArchitectureName(Architecture Arch) { switch (Arch) { #define ARCHINFO(Arch, Type, Subtype) \ - case Architecture::Arch: \ + case AK_##Arch: \ return #Arch; #include "llvm/TextAPI/MachO/Architecture.def" #undef ARCHINFO - case Architecture::unknown: + case AK_unknown: return "unknown"; } @@ -55,11 +55,11 @@ std::pair getCPUTypeFromArchitecture(Architecture Arch) { switch (Arch) { #define ARCHINFO(Arch, Type, Subtype) \ - case Architecture::Arch: \ + case AK_##Arch: \ return std::make_pair(Type, Subtype); #include "llvm/TextAPI/MachO/Architecture.def" #undef ARCHINFO - case Architecture::unknown: + case AK_unknown: return std::make_pair(0, 0); } Index: llvm/trunk/lib/TextAPI/MachO/ArchitectureSet.cpp =================================================================== --- llvm/trunk/lib/TextAPI/MachO/ArchitectureSet.cpp +++ llvm/trunk/lib/TextAPI/MachO/ArchitectureSet.cpp @@ -18,7 +18,7 @@ ArchitectureSet::ArchitectureSet(const std::vector &Archs) : ArchitectureSet() { for (auto Arch : Archs) { - if (Arch == Architecture::unknown) + if (Arch == AK_unknown) continue; set(Arch); } @@ -51,7 +51,7 @@ ArchitectureSet::operator std::vector() const { std::vector archs; for (auto arch : *this) { - if (arch == Architecture::unknown) + if (arch == AK_unknown) continue; archs.emplace_back(arch); } Index: llvm/trunk/lib/TextAPI/MachO/TextStubCommon.cpp =================================================================== --- llvm/trunk/lib/TextAPI/MachO/TextStubCommon.cpp +++ llvm/trunk/lib/TextAPI/MachO/TextStubCommon.cpp @@ -85,7 +85,7 @@ void ScalarBitSetTraits::bitset(IO &IO, ArchitectureSet &Archs) { #define ARCHINFO(arch, type, subtype) \ - IO.bitSetCase(Archs, #arch, 1U << static_cast(Architecture::arch)); + IO.bitSetCase(Archs, #arch, 1U << static_cast(AK_##arch)); #include "llvm/TextAPI/MachO/Architecture.def" #undef ARCHINFO } Index: llvm/trunk/unittests/TextAPI/TextStubV1Tests.cpp =================================================================== --- llvm/trunk/unittests/TextAPI/TextStubV1Tests.cpp +++ llvm/trunk/unittests/TextAPI/TextStubV1Tests.cpp @@ -87,8 +87,7 @@ EXPECT_TRUE(!!Result); auto File = std::move(Result.get()); EXPECT_EQ(FileType::TBD_V1, File->getFileType()); - auto Archs = Architecture::armv7 | Architecture::armv7s | - Architecture::armv7k | Architecture::arm64; + auto Archs = AK_armv7 | AK_armv7s | AK_armv7k | AK_arm64; EXPECT_EQ(Archs, File->getArchitectures()); EXPECT_EQ(PlatformKind::iOS, File->getPlatform()); EXPECT_EQ(std::string("Test.dylib"), File->getInstallName()); @@ -133,8 +132,7 @@ EXPECT_TRUE(!!Result); auto File = std::move(Result.get()); EXPECT_EQ(FileType::TBD_V1, File->getFileType()); - auto Archs = Architecture::armv7 | Architecture::armv7s | - Architecture::armv7k | Architecture::arm64; + auto Archs = AK_armv7 | AK_armv7s | AK_armv7k | AK_arm64; EXPECT_EQ(Archs, File->getArchitectures()); EXPECT_EQ(PlatformKind::iOS, File->getPlatform()); EXPECT_EQ(std::string("Test.dylib"), File->getInstallName()); @@ -178,23 +176,22 @@ File.setPath("libfoo.dylib"); File.setInstallName("/usr/lib/libfoo.dylib"); File.setFileType(FileType::TBD_V1); - File.setArchitectures(Architecture::i386 | Architecture::x86_64); + File.setArchitectures(AK_i386 | AK_x86_64); File.setPlatform(PlatformKind::macOS); File.setCurrentVersion(PackedVersion(1, 2, 3)); File.setSwiftABIVersion(5); File.setObjCConstraint(ObjCConstraintType::Retain_Release); - File.addAllowableClient("clientA", Architecture::x86_64); - File.addReexportedLibrary("/usr/lib/libfoo.dylib", Architecture::x86_64); - File.addSymbol(SymbolKind::GlobalSymbol, "_sym1", Architecture::i386); - File.addSymbol(SymbolKind::GlobalSymbol, "_sym2", Architecture::i386, + File.addAllowableClient("clientA", AK_x86_64); + File.addReexportedLibrary("/usr/lib/libfoo.dylib", AK_x86_64); + File.addSymbol(SymbolKind::GlobalSymbol, "_sym1", AK_i386); + File.addSymbol(SymbolKind::GlobalSymbol, "_sym2", AK_i386, SymbolFlags::WeakDefined); - File.addSymbol(SymbolKind::GlobalSymbol, "_sym3", Architecture::i386, + File.addSymbol(SymbolKind::GlobalSymbol, "_sym3", AK_i386, SymbolFlags::ThreadLocalValue); - File.addSymbol(SymbolKind::ObjectiveCClass, "Class1", Architecture::x86_64); - File.addSymbol(SymbolKind::ObjectiveCClassEHType, "Class1", - Architecture::x86_64); + File.addSymbol(SymbolKind::ObjectiveCClass, "Class1", AK_x86_64); + File.addSymbol(SymbolKind::ObjectiveCClassEHType, "Class1", AK_x86_64); File.addSymbol(SymbolKind::ObjectiveCInstanceVariable, "Class1._ivar1", - Architecture::x86_64); + AK_x86_64); SmallString<4096> Buffer; raw_svector_ostream OS(Buffer); Index: llvm/trunk/unittests/TextAPI/TextStubV2Tests.cpp =================================================================== --- llvm/trunk/unittests/TextAPI/TextStubV2Tests.cpp +++ llvm/trunk/unittests/TextAPI/TextStubV2Tests.cpp @@ -89,8 +89,7 @@ EXPECT_TRUE(!!Result); auto File = std::move(Result.get()); EXPECT_EQ(FileType::TBD_V2, File->getFileType()); - auto Archs = Architecture::armv7 | Architecture::armv7s | - Architecture::armv7k | Architecture::arm64; + auto Archs = AK_armv7 | AK_armv7s | AK_armv7k | AK_arm64; EXPECT_EQ(Archs, File->getArchitectures()); EXPECT_EQ(PlatformKind::iOS, File->getPlatform()); EXPECT_EQ(std::string("Test.dylib"), File->getInstallName()); @@ -157,8 +156,7 @@ EXPECT_TRUE(!!Result); auto File = std::move(Result.get()); EXPECT_EQ(FileType::TBD_V2, File->getFileType()); - auto Archs = Architecture::armv7 | Architecture::armv7s | - Architecture::armv7k | Architecture::arm64; + auto Archs = AK_armv7 | AK_armv7s | AK_armv7k | AK_arm64; EXPECT_EQ(Archs, File->getArchitectures()); EXPECT_EQ(PlatformKind::iOS, File->getPlatform()); EXPECT_EQ(std::string("Test.dylib"), File->getInstallName()); @@ -201,25 +199,24 @@ File.setPath("libfoo.dylib"); File.setInstallName("/usr/lib/libfoo.dylib"); File.setFileType(FileType::TBD_V2); - File.setArchitectures(Architecture::i386 | Architecture::x86_64); + File.setArchitectures(AK_i386 | AK_x86_64); File.setPlatform(PlatformKind::macOS); File.setCurrentVersion(PackedVersion(1, 2, 3)); File.setTwoLevelNamespace(); File.setApplicationExtensionSafe(); File.setSwiftABIVersion(5); File.setObjCConstraint(ObjCConstraintType::Retain_Release); - File.addAllowableClient("clientA", Architecture::x86_64); - File.addReexportedLibrary("/usr/lib/libfoo.dylib", Architecture::x86_64); - File.addSymbol(SymbolKind::GlobalSymbol, "_sym1", Architecture::i386); - File.addSymbol(SymbolKind::GlobalSymbol, "_sym2", Architecture::i386, + File.addAllowableClient("clientA", AK_x86_64); + File.addReexportedLibrary("/usr/lib/libfoo.dylib", AK_x86_64); + File.addSymbol(SymbolKind::GlobalSymbol, "_sym1", AK_i386); + File.addSymbol(SymbolKind::GlobalSymbol, "_sym2", AK_i386, SymbolFlags::WeakDefined); - File.addSymbol(SymbolKind::GlobalSymbol, "_sym3", Architecture::i386, + File.addSymbol(SymbolKind::GlobalSymbol, "_sym3", AK_i386, SymbolFlags::ThreadLocalValue); - File.addSymbol(SymbolKind::ObjectiveCClass, "Class1", Architecture::x86_64); - File.addSymbol(SymbolKind::ObjectiveCClassEHType, "Class1", - Architecture::x86_64); + File.addSymbol(SymbolKind::ObjectiveCClass, "Class1", AK_x86_64); + File.addSymbol(SymbolKind::ObjectiveCClassEHType, "Class1", AK_x86_64); File.addSymbol(SymbolKind::ObjectiveCInstanceVariable, "Class1._ivar1", - Architecture::x86_64); + AK_x86_64); SmallString<4096> Buffer; raw_svector_ostream OS(Buffer);