upgrade for removed functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79822 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-08-23 04:47:35 +00:00
parent 569f121f4e
commit 0c47a41207

View File

@ -13,9 +13,8 @@
#include "llvm/Metadata.h"
#include "llvm/Module.h"
#include "llvm/Type.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/ValueHandle.h"
#include <sstream>
using namespace llvm;
namespace {
@ -51,7 +50,8 @@ TEST(MDStringTest, PrintingSimple) {
strncpy(str, "aaaaaaaaaaaaa", 13);
delete[] str;
std::ostringstream oss;
std::string Str;
raw_string_ostream oss(Str);
s->print(oss);
EXPECT_STREQ("metadata !\"testing 1 2 3\"", oss.str().c_str());
}
@ -60,7 +60,8 @@ TEST(MDStringTest, PrintingSimple) {
TEST(MDStringTest, PrintingComplex) {
char str[5] = {0, '\n', '"', '\\', -1};
MDString *s = MDString::get(Context, StringRef(str+0, 5));
std::ostringstream oss;
std::string Str;
raw_string_ostream oss(Str);
s->print(oss);
EXPECT_STREQ("metadata !\"\\00\\0A\\22\\5C\\FF\"", oss.str().c_str());
}
@ -94,14 +95,16 @@ TEST(MDNodeTest, Simple) {
EXPECT_EQ(1u, n2->getNumElements());
EXPECT_EQ(n1, n2->getElement(0));
std::ostringstream oss1, oss2;
n1->print(oss1);
n2->print(oss2);
std::string Str;
raw_string_ostream oss(Str);
n1->print(oss);
EXPECT_STREQ("!0 = metadata !{metadata !\"abc\", i8 0, metadata !\"123\"}\n",
oss1.str().c_str());
oss.str().c_str());
Str.clear();
n2->print(oss);
EXPECT_STREQ("!0 = metadata !{metadata !1}\n"
"!1 = metadata !{metadata !\"abc\", i8 0, metadata !\"123\"}\n",
oss2.str().c_str());
oss.str().c_str());
}
TEST(MDNodeTest, Delete) {
@ -116,7 +119,8 @@ TEST(MDNodeTest, Delete) {
delete I;
std::ostringstream oss;
std::string Str;
raw_string_ostream oss(Str);
wvh->print(oss);
EXPECT_STREQ("!0 = metadata !{null}\n", oss.str().c_str());
}
@ -135,7 +139,8 @@ TEST(NamedMDNodeTest, Search) {
Module *M = new Module("MyModule", getGlobalContext());
const char *Name = "llvm.NMD1";
NamedMDNode *NMD = NamedMDNode::Create(getGlobalContext(), Name, &Nodes[0], 2, M);
std::ostringstream oss;
std::string Str;
raw_string_ostream oss(Str);
NMD->print(oss);
EXPECT_STREQ("!llvm.NMD1 = !{!0, !1}\n!0 = metadata !{i32 1}\n"
"!1 = metadata !{i32 2}\n",