From 82f9a5ba965dc1a40fe955b8205dd863bf6385cf Mon Sep 17 00:00:00 2001 From: Youngsuk Kim Date: Wed, 3 Jul 2024 05:34:28 -0500 Subject: [llvm] 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()`. --- llvm/lib/Support/LockFileManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Support/LockFileManager.cpp') diff --git a/llvm/lib/Support/LockFileManager.cpp b/llvm/lib/Support/LockFileManager.cpp index 3169aa2..ea040cc 100644 --- a/llvm/lib/Support/LockFileManager.cpp +++ b/llvm/lib/Support/LockFileManager.cpp @@ -228,7 +228,7 @@ LockFileManager::LockFileManager(StringRef FileName) std::string S("failed to create link "); raw_string_ostream OSS(S); OSS << LockFileName.str() << " to " << UniqueLockFileName.str(); - setError(EC, OSS.str()); + setError(EC, S); return; } @@ -274,7 +274,7 @@ std::string LockFileManager::getErrorMessage() const { raw_string_ostream OSS(Str); if (!ErrCodeMsg.empty()) OSS << ": " << ErrCodeMsg; - return OSS.str(); + return Str; } return ""; } -- cgit v1.1