Imported Upstream version 5.18.0.167

Former-commit-id: 289509151e0fee68a1b591a20c9f109c3c789d3a
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-10-20 08:25:10 +00:00
parent e19d552987
commit b084638f15
28489 changed files with 184 additions and 3866856 deletions

View File

@ -1,9 +0,0 @@
set(LLVM_LINK_COMPONENTS
Object
)
add_llvm_unittest(ObjectTests
SymbolSizeTest.cpp
SymbolicFileTest.cpp
)

View File

@ -1,33 +0,0 @@
//===- SymbolSizeTest.cpp - Tests for SymbolSize.cpp ----------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Object/SymbolSize.h"
#include "gtest/gtest.h"
using namespace llvm;
using namespace llvm::object;
TEST(Object, SymbolSizeSort) {
auto it = symbol_iterator(SymbolRef());
std::vector<SymEntry> Syms{
SymEntry{it, 0xffffffff00000000ull, 1, 0},
SymEntry{it, 0x00ffffff00000000ull, 2, 0},
SymEntry{it, 0x00ffffff000000ffull, 3, 0},
SymEntry{it, 0x0000000100000000ull, 4, 0},
SymEntry{it, 0x00000000000000ffull, 5, 0},
SymEntry{it, 0x00000001000000ffull, 6, 0},
SymEntry{it, 0x000000010000ffffull, 7, 0},
};
array_pod_sort(Syms.begin(), Syms.end(), compareAddress);
for (unsigned I = 0, N = Syms.size(); I < N - 1; ++I) {
EXPECT_LE(Syms[I].Address, Syms[I + 1].Address);
}
}

View File

@ -1,42 +0,0 @@
//===- SymbolicFileTest.cpp - Tests for SymbolicFile.cpp ------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Object/SymbolicFile.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/raw_ostream.h"
#include "gtest/gtest.h"
#include <sstream>
TEST(Object, DataRefImplOstream) {
std::string s;
llvm::raw_string_ostream OS(s);
llvm::object::DataRefImpl Data;
Data.d.a = 0xeeee0000;
Data.d.b = 0x0000ffff;
static_assert(sizeof Data.p == sizeof(uint64_t) ||
sizeof Data.p == sizeof(uint32_t),
"Test expected pointer type to be 32 or 64-bit.");
char const *Expected;
if (sizeof Data.p == sizeof(uint64_t)) {
Expected = llvm::sys::IsLittleEndianHost
? "(0xffffeeee0000 (0xeeee0000, 0x0000ffff))"
: "(0xeeee00000000ffff (0xeeee0000, 0x0000ffff))";
}
else {
Expected = "(0xeeee0000 (0xeeee0000, 0x0000ffff))";
}
OS << Data;
OS.flush();
EXPECT_EQ(Expected, s);
}