[llvm-commits] [llvm] r79822 - /llvm/trunk/unittests/VMCore/MetadataTest.cpp
Chris Lattner
sabre at nondot.org
Sat Aug 22 21:47:36 PDT 2009
Author: lattner
Date: Sat Aug 22 23:47:35 2009
New Revision: 79822
URL: http://llvm.org/viewvc/llvm-project?rev=79822&view=rev
Log:
upgrade for removed functions.
Modified:
llvm/trunk/unittests/VMCore/MetadataTest.cpp
Modified: llvm/trunk/unittests/VMCore/MetadataTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/VMCore/MetadataTest.cpp?rev=79822&r1=79821&r2=79822&view=diff
==============================================================================
--- llvm/trunk/unittests/VMCore/MetadataTest.cpp (original)
+++ llvm/trunk/unittests/VMCore/MetadataTest.cpp Sat Aug 22 23:47:35 2009
@@ -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 @@
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, 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 @@
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 @@
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 @@
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",
More information about the llvm-commits
mailing list