aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Interpreter/InterpreterTest.cpp
diff options
context:
space:
mode:
authorYoungsuk Kim <youngsuk.kim@hpe.com>2024-06-30 10:02:47 -0500
committerYoungsuk Kim <youngsuk.kim@hpe.com>2024-06-30 10:02:49 -0500
commitac84ada9a169a72ad136ef05c2c194f594f24a37 (patch)
treecb91f6bd179da3c65ac31df81e0359b70e96330b /clang/unittests/Interpreter/InterpreterTest.cpp
parent2051736f7bc3fb1a8daaeecc854f93604a590aba (diff)
downloadllvm-ac84ada9a169a72ad136ef05c2c194f594f24a37.zip
llvm-ac84ada9a169a72ad136ef05c2c194f594f24a37.tar.gz
llvm-ac84ada9a169a72ad136ef05c2c194f594f24a37.tar.bz2
[clang] Avoid 'raw_string_ostream::str' (NFC)
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 'clang/unittests/Interpreter/InterpreterTest.cpp')
-rw-r--r--clang/unittests/Interpreter/InterpreterTest.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/unittests/Interpreter/InterpreterTest.cpp b/clang/unittests/Interpreter/InterpreterTest.cpp
index bbd8541..29c5ead 100644
--- a/clang/unittests/Interpreter/InterpreterTest.cpp
+++ b/clang/unittests/Interpreter/InterpreterTest.cpp
@@ -101,7 +101,7 @@ TEST_F(InterpreterTest, Errors) {
auto Interp = createInterpreter(ExtraArgs, DiagPrinter.get());
auto Err = Interp->Parse("intentional_error v1 = 42; ").takeError();
using ::testing::HasSubstr;
- EXPECT_THAT(DiagnosticsOS.str(),
+ EXPECT_THAT(DiagnosticOutput,
HasSubstr("error: unknown type name 'intentional_error'"));
EXPECT_EQ("Parsing failed.", llvm::toString(std::move(Err)));
@@ -186,7 +186,7 @@ static std::string MangleName(NamedDecl *ND) {
std::string mangledName;
llvm::raw_string_ostream RawStr(mangledName);
MangleC->mangleName(ND, RawStr);
- return RawStr.str();
+ return mangledName;
}
TEST_F(InterpreterTest, FindMangledNameSymbol) {