1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[TextAPI] TBD Reader/Writer (bot fixes: take 2)

Replace the tuple with a struct to work around an explicit constructor bug.

llvm-svn: 347827
This commit is contained in:
Juergen Ributzka 2018-11-29 02:28:58 +00:00
parent 2da4f4508d
commit 02a93e9f48
2 changed files with 30 additions and 8 deletions

View File

@ -16,11 +16,21 @@
using namespace llvm;
using namespace llvm::MachO;
using ExportedSymbol = std::tuple<SymbolKind, std::string, bool, bool>;
struct ExportedSymbol {
SymbolKind Kind;
std::string Name;
bool WeakDefined;
bool ThreadLocalValue;
};
using ExportedSymbolSeq = std::vector<ExportedSymbol>;
inline bool operator<(const ExportedSymbol &lhs, const ExportedSymbol &rhs) {
return std::get<1>(lhs) < std::get<1>(rhs);
return std::tie(lhs.Kind, lhs.Name) < std::tie(rhs.Kind, rhs.Name);
}
inline bool operator==(const ExportedSymbol &lhs, const ExportedSymbol &rhs) {
return std::tie(lhs.Kind, lhs.Name, lhs.WeakDefined, lhs.ThreadLocalValue) ==
std::tie(rhs.Kind, rhs.Name, rhs.WeakDefined, rhs.ThreadLocalValue);
}
static ExportedSymbol TBDv1Symbols[] = {
@ -100,8 +110,9 @@ TEST(TBDv1, ReadFile) {
for (const auto *Sym : File->symbols()) {
EXPECT_FALSE(Sym->isWeakReferenced());
EXPECT_FALSE(Sym->isUndefined());
Exports.emplace_back(Sym->getKind(), Sym->getName(), Sym->isWeakDefined(),
Sym->isThreadLocalValue());
Exports.emplace_back(ExportedSymbol{Sym->getKind(), Sym->getName(),
Sym->isWeakDefined(),
Sym->isThreadLocalValue()});
}
llvm::sort(Exports.begin(), Exports.end());

View File

@ -16,11 +16,21 @@
using namespace llvm;
using namespace llvm::MachO;
using ExportedSymbol = std::tuple<SymbolKind, std::string, bool, bool>;
struct ExportedSymbol {
SymbolKind Kind;
std::string Name;
bool WeakDefined;
bool ThreadLocalValue;
};
using ExportedSymbolSeq = std::vector<ExportedSymbol>;
inline bool operator<(const ExportedSymbol &lhs, const ExportedSymbol &rhs) {
return std::get<1>(lhs) < std::get<1>(rhs);
return std::tie(lhs.Kind, lhs.Name) < std::tie(rhs.Kind, rhs.Name);
}
inline bool operator==(const ExportedSymbol &lhs, const ExportedSymbol &rhs) {
return std::tie(lhs.Kind, lhs.Name, lhs.WeakDefined, lhs.ThreadLocalValue) ==
std::tie(rhs.Kind, rhs.Name, rhs.WeakDefined, rhs.ThreadLocalValue);
}
static ExportedSymbol TBDv2Symbols[] = {
@ -102,8 +112,9 @@ TEST(TBDv2, ReadFile) {
for (const auto *Sym : File->symbols()) {
EXPECT_FALSE(Sym->isWeakReferenced());
EXPECT_FALSE(Sym->isUndefined());
Exports.emplace_back(Sym->getKind(), Sym->getName(), Sym->isWeakDefined(),
Sym->isThreadLocalValue());
Exports.emplace_back(ExportedSymbol{Sym->getKind(), Sym->getName(),
Sym->isWeakDefined(),
Sym->isThreadLocalValue()});
}
llvm::sort(Exports.begin(), Exports.end());