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

@@ -1438,7 +1438,7 @@ bool ScriptInterpreterPython::GenerateTypeSynthClass(StringList &user_input,
// Create the function name & definition string.
sstr.Printf("class %s:", auto_generated_class_name.c_str());
auto_generated_class.AppendString(sstr.GetData());
auto_generated_class.AppendString(sstr.GetString());
// Wrap everything up inside the class, increasing the indentation.
// we don't need to play any fancy indentation tricks here because there is no
@@ -1446,7 +1446,7 @@ bool ScriptInterpreterPython::GenerateTypeSynthClass(StringList &user_input,
for (int i = 0; i < num_lines; ++i) {
sstr.Clear();
sstr.Printf(" %s", user_input.GetStringAtIndex(i));
auto_generated_class.AppendString(sstr.GetData());
auto_generated_class.AppendString(sstr.GetString());
}
// Verify that the results are valid Python.
@@ -2873,7 +2873,7 @@ bool ScriptInterpreterPython::GetDocumentationForItem(const char *item,
StreamString str_stream;
str_stream.Printf(
"Function %s was not found. Containing module might be missing.", item);
dest.assign(str_stream.GetData());
dest = str_stream.GetString();
return false;
}
}