From dbaf055236e5a86762c97bb863fa915357e04a13 Mon Sep 17 00:00:00 2001 From: Juergen Ributzka Date: Thu, 29 Nov 2018 02:28:58 +0000 Subject: [TextAPI] TBD Reader/Writer (bot fixes: take 2) Replace the tuple with a struct to work around an explicit constructor bug. llvm-svn: 347827 --- llvm/unittests/TextAPI/TextStubV2Tests.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'llvm/unittests/TextAPI/TextStubV2Tests.cpp') diff --git a/llvm/unittests/TextAPI/TextStubV2Tests.cpp b/llvm/unittests/TextAPI/TextStubV2Tests.cpp index 79d6cac8938..62032422dd7 100644 --- a/llvm/unittests/TextAPI/TextStubV2Tests.cpp +++ b/llvm/unittests/TextAPI/TextStubV2Tests.cpp @@ -16,11 +16,21 @@ using namespace llvm; using namespace llvm::MachO; -using ExportedSymbol = std::tuple; +struct ExportedSymbol { + SymbolKind Kind; + std::string Name; + bool WeakDefined; + bool ThreadLocalValue; +}; using ExportedSymbolSeq = std::vector; 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()); -- cgit v1.2.3