MDString
- Rename member function size(). New name is length().
- Store string beginning and length. Earlier it used to store string end.
llvm-svn: 76841
diff --git a/llvm/unittests/VMCore/MetadataTest.cpp b/llvm/unittests/VMCore/MetadataTest.cpp
index 732719e..d612808 100644
--- a/llvm/unittests/VMCore/MetadataTest.cpp
+++ b/llvm/unittests/VMCore/MetadataTest.cpp
@@ -23,9 +23,9 @@
// MDString objects, even with the same string pointer and nulls in the string.
TEST(MDStringTest, CreateDifferent) {
char x[3] = { 'f', 0, 'A' };
- MDString *s1 = getGlobalContext().getMDString(&x[0], &x[3]);
+ MDString *s1 = getGlobalContext().getMDString(&x[0], 3);
x[2] = 'B';
- MDString *s2 = getGlobalContext().getMDString(&x[0], &x[3]);
+ MDString *s2 = getGlobalContext().getMDString(&x[0], 3);
EXPECT_NE(s1, s2);
}
@@ -35,8 +35,8 @@
char x[4] = { 'a', 'b', 'c', 'X' };
char y[4] = { 'a', 'b', 'c', 'Y' };
- MDString *s1 = getGlobalContext().getMDString(&x[0], &x[3]);
- MDString *s2 = getGlobalContext().getMDString(&y[0], &y[3]);
+ MDString *s1 = getGlobalContext().getMDString(&x[0], 3);
+ MDString *s2 = getGlobalContext().getMDString(&y[0], 3);
EXPECT_EQ(s1, s2);
}
@@ -44,7 +44,7 @@
TEST(MDStringTest, PrintingSimple) {
char *str = new char[13];
strncpy(str, "testing 1 2 3", 13);
- MDString *s = getGlobalContext().getMDString(str, str+13);
+ MDString *s = getGlobalContext().getMDString(str, 13);
strncpy(str, "aaaaaaaaaaaaa", 13);
delete[] str;
@@ -56,7 +56,7 @@
// Test printing of MDString with non-printable characters.
TEST(MDStringTest, PrintingComplex) {
char str[5] = {0, '\n', '"', '\\', -1};
- MDString *s = getGlobalContext().getMDString(str+0, str+5);
+ MDString *s = getGlobalContext().getMDString(str+0, 5);
std::ostringstream oss;
s->print(oss);
EXPECT_STREQ("metadata !\"\\00\\0A\\22\\5C\\FF\"", oss.str().c_str());
@@ -67,8 +67,8 @@
char x[3] = { 'a', 'b', 'c' };
char y[3] = { '1', '2', '3' };
- MDString *s1 = getGlobalContext().getMDString(&x[0], &x[3]);
- MDString *s2 = getGlobalContext().getMDString(&y[0], &y[3]);
+ MDString *s1 = getGlobalContext().getMDString(&x[0], 3);
+ MDString *s2 = getGlobalContext().getMDString(&y[0], 3);
ConstantInt *CI = getGlobalContext().getConstantInt(APInt(8, 0));
std::vector<Value *> V;