diff options
author | Alp Toker <alp@nuanti.com> | 2014-06-26 00:00:48 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-06-26 00:00:48 +0000 |
commit | 614717388cfccd6a6d34ed17a4680181e22cab22 (patch) | |
tree | 98ceaaca266d95b9e657783de3452ee20f891178 /llvm/lib/CodeGen/MachineScheduler.cpp | |
parent | 49f09fd88afbf04a2c661c1917665b46f96729fa (diff) | |
download | llvm-614717388cfccd6a6d34ed17a4680181e22cab22.zip llvm-614717388cfccd6a6d34ed17a4680181e22cab22.tar.gz llvm-614717388cfccd6a6d34ed17a4680181e22cab22.tar.bz2 |
Introduce a string_ostream string builder facilty
string_ostream is a safe and efficient string builder that combines opaque
stack storage with a built-in ostream interface.
small_string_ostream<bytes> additionally permits an explicit stack storage size
other than the default 128 bytes to be provided. Beyond that, storage is
transferred to the heap.
This convenient class can be used in most places an
std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair
would previously have been used, in order to guarantee consistent access
without byte truncation.
The patch also converts much of LLVM to use the new facility. These changes
include several probable bug fixes for truncated output, a programming error
that's no longer possible with the new interface.
llvm-svn: 211749
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineScheduler.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp index 0baf2a6..f7459bb 100644 --- a/llvm/lib/CodeGen/MachineScheduler.cpp +++ b/llvm/lib/CodeGen/MachineScheduler.cpp @@ -3235,8 +3235,7 @@ struct DOTGraphTraits<ScheduleDAGMI*> : public DefaultDOTGraphTraits { } static std::string getNodeLabel(const SUnit *SU, const ScheduleDAG *G) { - std::string Str; - raw_string_ostream SS(Str); + string_ostream SS; const ScheduleDAGMI *DAG = static_cast<const ScheduleDAGMI*>(G); const SchedDFSResult *DFS = DAG->hasVRegLiveness() ? static_cast<const ScheduleDAGMILive*>(G)->getDFSResult() : nullptr; |