Update mclinker for LLVM rebase to r222494.
This corresponds to the following upstream mclinker change:
commit b2f1691276052c4215abf36715d43248d6337cf8
Author: Diana Chen <mysekki@gmail.com>
Date: Tue Nov 25 14:03:29 2014 +0800
option: Allow `-hash-style' can be specified zero or more times
Change-Id: I332546680bb45cf9692adfa2c2d3dcdc84361afc
diff --git a/unittests/NamePoolTest.cpp b/unittests/NamePoolTest.cpp
index 614ee6a..57c78fe 100644
--- a/unittests/NamePoolTest.cpp
+++ b/unittests/NamePoolTest.cpp
@@ -7,11 +7,11 @@
//
//===----------------------------------------------------------------------===//
#include "NamePoolTest.h"
-#include <mcld/LD/NamePool.h>
-#include <mcld/LD/Resolver.h>
-#include <mcld/LD/StaticResolver.h>
-#include <mcld/LD/ResolveInfo.h>
-#include <mcld/LD/LDSymbol.h>
+#include "mcld/LD/NamePool.h"
+#include "mcld/LD/Resolver.h"
+#include "mcld/LD/StaticResolver.h"
+#include "mcld/LD/ResolveInfo.h"
+#include "mcld/LD/LDSymbol.h"
#include <llvm/ADT/StringRef.h>
#include <string>
#include <cstdio>
@@ -19,45 +19,39 @@
using namespace mcld;
using namespace mcldtest;
-
// Constructor can do set-up work for all test here.
-NamePoolTest::NamePoolTest()
-{
+NamePoolTest::NamePoolTest() {
// create testee. modify it if need
StaticResolver resolver;
m_pTestee = new NamePool(resolver, 10);
}
// Destructor can do clean-up work that doesn't throw exceptions here.
-NamePoolTest::~NamePoolTest()
-{
+NamePoolTest::~NamePoolTest() {
delete m_pTestee;
}
// SetUp() will be called immediately before each test.
-void NamePoolTest::SetUp()
-{
+void NamePoolTest::SetUp() {
}
// TearDown() will be called immediately after each test.
-void NamePoolTest::TearDown()
-{
+void NamePoolTest::TearDown() {
}
//==========================================================================//
// Testcases
//
-
-TEST_F( NamePoolTest, insertString ) {
- const char *s1 = "Hello MCLinker";
+TEST_F(NamePoolTest, insertString) {
+ const char* s1 = "Hello MCLinker";
llvm::StringRef result1 = m_pTestee->insertString(s1);
EXPECT_NE(s1, result1.data());
EXPECT_STREQ(s1, result1.data());
}
-TEST_F( NamePoolTest, insertSameString ) {
- const char *s1 = "Hello MCLinker";
+TEST_F(NamePoolTest, insertSameString) {
+ const char* s1 = "Hello MCLinker";
std::string s2(s1);
llvm::StringRef result1 = m_pTestee->insertString(s1);
llvm::StringRef result2 = m_pTestee->insertString(s2.c_str());
@@ -66,8 +60,8 @@
EXPECT_EQ(result1.data(), result2.data());
}
-TEST_F( NamePoolTest, insert_local_defined_Symbol ) {
- const char *name = "Hello MCLinker";
+TEST_F(NamePoolTest, insert_local_defined_Symbol) {
+ const char* name = "Hello MCLinker";
bool isDyn = false;
ResolveInfo::Type type = ResolveInfo::Function;
ResolveInfo::Desc desc = ResolveInfo::Define;
@@ -76,15 +70,8 @@
uint64_t size = 0;
ResolveInfo::Visibility other = ResolveInfo::Default;
Resolver::Result result1;
- m_pTestee->insertSymbol(name,
- isDyn,
- type,
- desc,
- binding,
- size,
- other,
- NULL,
- result1);
+ m_pTestee->insertSymbol(
+ name, isDyn, type, desc, binding, size, other, NULL, result1);
EXPECT_NE(name, result1.info->name());
EXPECT_STREQ(name, result1.info->name());
@@ -96,15 +83,8 @@
EXPECT_EQ(other, result1.info->visibility());
Resolver::Result result2;
- m_pTestee->insertSymbol(name,
- isDyn,
- type,
- desc,
- binding,
- size,
- other,
- NULL,
- result2);
+ m_pTestee->insertSymbol(
+ name, isDyn, type, desc, binding, size, other, NULL, result2);
EXPECT_NE(name, result1.info->name());
EXPECT_STREQ(name, result1.info->name());
@@ -118,8 +98,8 @@
EXPECT_NE(result1.existent, result2.existent);
}
-TEST_F( NamePoolTest, insert_global_reference_Symbol ) {
- const char *name = "Hello MCLinker";
+TEST_F(NamePoolTest, insert_global_reference_Symbol) {
+ const char* name = "Hello MCLinker";
bool isDyn = false;
ResolveInfo::Type type = ResolveInfo::NoType;
ResolveInfo::Desc desc = ResolveInfo::Undefined;
@@ -127,15 +107,8 @@
uint64_t size = 0;
ResolveInfo::Visibility other = ResolveInfo::Default;
Resolver::Result result1;
- m_pTestee->insertSymbol(name,
- isDyn,
- type,
- desc,
- binding,
- size,
- other,
- NULL,
- result1);
+ m_pTestee->insertSymbol(
+ name, isDyn, type, desc, binding, size, other, NULL, result1);
EXPECT_NE(name, result1.info->name());
EXPECT_STREQ(name, result1.info->name());
@@ -147,15 +120,8 @@
EXPECT_EQ(other, result1.info->visibility());
Resolver::Result result2;
- m_pTestee->insertSymbol(name,
- isDyn,
- type,
- desc,
- binding,
- size,
- other,
- NULL,
- result2);
+ m_pTestee->insertSymbol(
+ name, isDyn, type, desc, binding, size, other, NULL, result2);
EXPECT_EQ(result1.info, result2.info);
@@ -170,98 +136,71 @@
NULL,
result3);
-
EXPECT_NE(result1.info, result3.info);
}
-
-TEST_F( NamePoolTest, insertSymbol_after_insert_same_string ) {
- const char *name = "Hello MCLinker";
+TEST_F(NamePoolTest, insertSymbol_after_insert_same_string) {
+ const char* name = "Hello MCLinker";
bool isDyn = false;
LDSymbol::Type type = LDSymbol::Defined;
LDSymbol::Binding binding = LDSymbol::Global;
- const llvm::MCSectionData *section = 0;
+ const llvm::MCSectionData* section = 0;
uint64_t value = 0;
uint64_t size = 0;
uint8_t other = 0;
- const char *result1 = m_pTestee->insertString(name);
- LDSymbol *sym = m_pTestee->insertSymbol(name,
- isDyn,
- type,
- binding,
- section,
- value,
- size,
- other);
+ const char* result1 = m_pTestee->insertString(name);
+ LDSymbol* sym = m_pTestee->insertSymbol(
+ name, isDyn, type, binding, section, value, size, other);
EXPECT_STREQ(name, sym->name());
EXPECT_EQ(result1, sym->name());
char s[16];
strcpy(s, result1);
- const char *result2 = m_pTestee->insertString(result1);
- const char *result3 = m_pTestee->insertString(s);
+ const char* result2 = m_pTestee->insertString(result1);
+ const char* result3 = m_pTestee->insertString(s);
EXPECT_EQ(result1, result2);
EXPECT_EQ(result1, result3);
}
-
-TEST_F( NamePoolTest, insert_16384_weak_reference_symbols ) {
+TEST_F(NamePoolTest, insert_16384_weak_reference_symbols) {
char name[16];
bool isDyn = false;
LDSymbol::Type type = LDSymbol::Reference;
LDSymbol::Binding binding = LDSymbol::Weak;
- const llvm::MCSectionData *section = 0;
+ const llvm::MCSectionData* section = 0;
uint64_t value = 0;
uint64_t size = 0;
uint8_t other = 0;
strcpy(name, "Hello MCLinker");
- LDSymbol *syms[128][128];
- for(int i=0; i<128 ;++i) {
+ LDSymbol* syms[128][128];
+ for (int i = 0; i < 128; ++i) {
name[0] = i;
- for(int j=0; j<128 ;++j) {
+ for (int j = 0; j < 128; ++j) {
name[1] = j;
- syms[i][j] = m_pTestee->insertSymbol(name,
- isDyn,
- type,
- binding,
- section,
- value,
- size,
- other);
+ syms[i][j] = m_pTestee->insertSymbol(
+ name, isDyn, type, binding, section, value, size, other);
ASSERT_STREQ(name, syms[i][j]->name());
}
}
- for(int i=127; i>=0 ;--i) {
+ for (int i = 127; i >= 0; --i) {
name[0] = i;
- for(int j=0; j<128 ;++j) {
+ for (int j = 0; j < 128; ++j) {
name[1] = j;
- LDSymbol *sym = m_pTestee->insertSymbol(name,
- isDyn,
- type,
- binding,
- section,
- value,
- size,
- other);
+ LDSymbol* sym = m_pTestee->insertSymbol(
+ name, isDyn, type, binding, section, value, size, other);
ASSERT_EQ(sym, syms[i][j]);
}
}
- for(int i=0; i<128 ;++i) {
+ for (int i = 0; i < 128; ++i) {
name[0] = i;
- for(int j=0; j<128 ;++j) {
+ for (int j = 0; j < 128; ++j) {
name[1] = j;
- LDSymbol *sym = m_pTestee->insertSymbol(name,
- isDyn,
- type,
- binding,
- section,
- value,
- size,
- other);
+ LDSymbol* sym = m_pTestee->insertSymbol(
+ name, isDyn, type, binding, section, value, size, other);
ASSERT_EQ(sym, syms[i][j]);
}
}