aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/Version.cpp
diff options
context:
space:
mode:
authorLogan Smith <logan.r.smith0@gmail.com>2021-12-09 15:02:35 -0800
committerLogan Smith <logan.r.smith0@gmail.com>2021-12-09 16:05:46 -0800
commit0cf6f7b128dd457711ba5c0ebfcb8143dc1632f8 (patch)
treedbc0e54de2ac087e9ab995c6338b08407aa108a5 /clang/lib/Basic/Version.cpp
parent08eb614e309048b695a9eb0d94e636b2324de094 (diff)
downloadllvm-0cf6f7b128dd457711ba5c0ebfcb8143dc1632f8.zip
llvm-0cf6f7b128dd457711ba5c0ebfcb8143dc1632f8.tar.gz
llvm-0cf6f7b128dd457711ba5c0ebfcb8143dc1632f8.tar.bz2
[NFC][clang] Return underlying strings directly instead of OS.str()
This avoids an unnecessary copy required by 'return OS.str()', allowing instead for NRVO or implicit move. The .str() call (which flushes the stream) is no longer required since 65b13610a5226b84889b923bae884ba395ad084d, which made raw_string_ostream unbuffered by default. Differential Revision: https://reviews.llvm.org/D115374
Diffstat (limited to 'clang/lib/Basic/Version.cpp')
-rw-r--r--clang/lib/Basic/Version.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Basic/Version.cpp b/clang/lib/Basic/Version.cpp
index af3118b..e205da7 100644
--- a/clang/lib/Basic/Version.cpp
+++ b/clang/lib/Basic/Version.cpp
@@ -82,7 +82,7 @@ std::string getClangFullRepositoryVersion() {
OS << LLVMRepo << ' ';
OS << LLVMRev << ')';
}
- return OS.str();
+ return buf;
}
std::string getClangFullVersion() {
@@ -102,7 +102,7 @@ std::string getClangToolFullVersion(StringRef ToolName) {
OS << " " << repo;
}
- return OS.str();
+ return buf;
}
std::string getClangFullCPPVersion() {
@@ -120,7 +120,7 @@ std::string getClangFullCPPVersion() {
OS << " " << repo;
}
- return OS.str();
+ return buf;
}
} // end namespace clang