Don't allow direct access to StreamString's internal buffer.

This is a large API change that removes the two functions from
StreamString that return a std::string& and a const std::string&,
and instead provide one function which returns a StringRef.

Direct access to the underlying buffer violates the concept of
a "stream" which is intended to provide forward only access,
and makes porting to llvm::raw_ostream more difficult in the
future.

Differential Revision: https://reviews.llvm.org/D26698

llvm-svn: 287152
This commit is contained in:
Zachary Turner
2016-11-16 21:15:24 +00:00
parent 725dc14bb2
commit c156427ded
134 changed files with 448 additions and 453 deletions

View File

@@ -255,17 +255,17 @@ TEST_F(PythonDataObjectsTest, TestPythonString) {
// Test that creating a `PythonString` object works correctly with the
// string constructor
PythonString constructed_string(test_string2);
EXPECT_STREQ(test_string2, constructed_string.GetString().str().c_str());
EXPECT_STREQ(test_string2, constructed_string.c_str());
}
TEST_F(PythonDataObjectsTest, TestPythonStringToStr) {
const char *c_str = "PythonDataObjectsTest::TestPythonStringToStr";
PythonString str(c_str);
EXPECT_STREQ(c_str, str.GetString().str().c_str());
EXPECT_STREQ(c_str, str.c_str());
PythonString str_str = str.Str();
EXPECT_STREQ(c_str, str_str.GetString().str().c_str());
EXPECT_STREQ(c_str, str_str.c_str());
}
TEST_F(PythonDataObjectsTest, TestPythonIntegerToStr) {}
@@ -315,7 +315,7 @@ TEST_F(PythonDataObjectsTest, TestPythonListValueEquality) {
PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
EXPECT_EQ(long_value0, chk_int.GetInteger());
EXPECT_STREQ(string_value1, chk_str.GetString().str().c_str());
EXPECT_STREQ(string_value1, chk_str.c_str());
}
TEST_F(PythonDataObjectsTest, TestPythonListManipulation) {
@@ -343,7 +343,7 @@ TEST_F(PythonDataObjectsTest, TestPythonListManipulation) {
PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
EXPECT_EQ(long_value0, chk_int.GetInteger());
EXPECT_STREQ(string_value1, chk_str.GetString().str().c_str());
EXPECT_STREQ(string_value1, chk_str.c_str());
}
TEST_F(PythonDataObjectsTest, TestPythonListToStructuredList) {
@@ -466,7 +466,7 @@ TEST_F(PythonDataObjectsTest, TestPythonDictionaryValueEquality) {
PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
EXPECT_EQ(value_0, chk_int.GetInteger());
EXPECT_STREQ(value_1, chk_str.GetString().str().c_str());
EXPECT_STREQ(value_1, chk_str.c_str());
}
TEST_F(PythonDataObjectsTest, TestPythonDictionaryManipulation) {
@@ -503,7 +503,7 @@ TEST_F(PythonDataObjectsTest, TestPythonDictionaryManipulation) {
PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
EXPECT_EQ(value_0, chk_int.GetInteger());
EXPECT_STREQ(value_1, chk_str.GetString().str().c_str());
EXPECT_STREQ(value_1, chk_str.c_str());
}
TEST_F(PythonDataObjectsTest, TestPythonDictionaryToStructuredDictionary) {