aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/FileCheck/FileCheck.cpp
diff options
context:
space:
mode:
authorYoungsuk Kim <joseph942010@gmail.com>2024-06-29 18:50:52 -0400
committerGitHub <noreply@github.com>2024-06-29 18:50:52 -0400
commitcaf26b9437ae3e26d4c9c8680d3e755aafeda6ed (patch)
treebb65fa7064e017c1be7faf3ec7fcea6a1f4055a9 /llvm/utils/FileCheck/FileCheck.cpp
parent56ef6a2eb2a25d5960eafdb17eaaaa73cb318e57 (diff)
downloadllvm-caf26b9437ae3e26d4c9c8680d3e755aafeda6ed.zip
llvm-caf26b9437ae3e26d4c9c8680d3e755aafeda6ed.tar.gz
llvm-caf26b9437ae3e26d4c9c8680d3e755aafeda6ed.tar.bz2
[llvm][utils] Avoid 'raw_string_ostream::str()' (NFC) (#97160)
Since `raw_string_ostream` doesn't own the string buffer, it is desirable (in terms of memory safety) for users to directly reference the string buffer rather than use `raw_string_ostream::str()`. Work towards TODO comment to remove `raw_string_ostream::str()`.
Diffstat (limited to 'llvm/utils/FileCheck/FileCheck.cpp')
-rw-r--r--llvm/utils/FileCheck/FileCheck.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp
index a962518..9cf3a31 100644
--- a/llvm/utils/FileCheck/FileCheck.cpp
+++ b/llvm/utils/FileCheck/FileCheck.cpp
@@ -641,7 +641,7 @@ static void DumpAnnotatedInput(raw_ostream &OS, const FileCheckRequest &Req,
LineOS = &ElidedLinesOS;
else {
LineOS = &OS;
- DumpEllipsisOrElidedLines(OS, ElidedLinesOS.str(), LabelWidth);
+ DumpEllipsisOrElidedLines(OS, ElidedLines, LabelWidth);
}
// Print right-aligned line number.
@@ -723,7 +723,7 @@ static void DumpAnnotatedInput(raw_ostream &OS, const FileCheckRequest &Req,
++AnnotationItr;
}
}
- DumpEllipsisOrElidedLines(OS, ElidedLinesOS.str(), LabelWidth);
+ DumpEllipsisOrElidedLines(OS, ElidedLines, LabelWidth);
OS << ">>>>>>\n";
}