[lld] r262569 - Simplify string operations. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 2 16:51:23 PST 2016
Author: ruiu
Date: Wed Mar 2 18:51:23 2016
New Revision: 262569
URL: http://llvm.org/viewvc/llvm-project?rev=262569&view=rev
Log:
Simplify string operations. NFC.
Modified:
lld/trunk/lib/Config/Version.cpp
Modified: lld/trunk/lib/Config/Version.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Config/Version.cpp?rev=262569&r1=262568&r2=262569&view=diff
==============================================================================
--- lld/trunk/lib/Config/Version.cpp (original)
+++ lld/trunk/lib/Config/Version.cpp Wed Mar 2 18:51:23 2016
@@ -35,22 +35,15 @@ StringRef getLLDRevision() {
}
std::string getLLDRepositoryVersion() {
- std::string buf;
- llvm::raw_string_ostream OS(buf);
- std::string Path = getLLDRepositoryPath();
- std::string Revision = getLLDRevision();
- if (!Path.empty() || !Revision.empty()) {
- OS << '(';
- if (!Path.empty())
- OS << Path;
- if (!Revision.empty()) {
- if (!Path.empty())
- OS << ' ';
- OS << Revision;
- }
- OS << ')';
- }
- return OS.str();
+ std::string S = getLLDRepositoryPath();
+ std::string T = getLLDRevision();
+ if (S.empty() && T.empty())
+ return "";
+ if (!S.empty() && !T.empty())
+ return "(" + S + " " + T + ")";
+ if (!S.empty())
+ return "(" + S + ")";
+ return "(" + T + ")";
}
StringRef getLLDVersion() {
More information about the llvm-commits
mailing list