aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-config/llvm-config.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2020-01-28 20:23:46 +0100
committerBenjamin Kramer <benny.kra@googlemail.com>2020-01-28 23:25:25 +0100
commitadcd02683856c30ba6f349279509acecd90063df (patch)
tree7b5927ef2ecab1618842183fac5ebe848f5832dd /llvm/tools/llvm-config/llvm-config.cpp
parent5eaf44f99f0a0a3bdfa892892b8aaca841c8dbe0 (diff)
downloadllvm-adcd02683856c30ba6f349279509acecd90063df.zip
llvm-adcd02683856c30ba6f349279509acecd90063df.tar.gz
llvm-adcd02683856c30ba6f349279509acecd90063df.tar.bz2
Make llvm::StringRef to std::string conversions explicit.
This is how it should've been and brings it more in line with std::string_view. There should be no functional change here. This is mostly mechanical from a custom clang-tidy check, with a lot of manual fixups. It uncovers a lot of minor inefficiencies. This doesn't actually modify StringRef yet, I'll do that in a follow-up.
Diffstat (limited to 'llvm/tools/llvm-config/llvm-config.cpp')
-rw-r--r--llvm/tools/llvm-config/llvm-config.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp
index 6c31df3..df45c38 100644
--- a/llvm/tools/llvm-config/llvm-config.cpp
+++ b/llvm/tools/llvm-config/llvm-config.cpp
@@ -338,7 +338,7 @@ int main(int argc, char **argv) {
ActiveIncludeDir = ActivePrefix + "/include";
SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
sys::fs::make_absolute(ActivePrefix, path);
- ActiveBinDir = path.str();
+ ActiveBinDir = std::string(path.str());
ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
ActiveIncludeOption = "-I" + ActiveIncludeDir;
@@ -352,7 +352,8 @@ int main(int argc, char **argv) {
/// in the first place. This can't be done at configure/build time.
StringRef SharedExt, SharedVersionedExt, SharedDir, SharedPrefix, StaticExt,
- StaticPrefix, StaticDir = "lib", DirSep = "/";
+ StaticPrefix, StaticDir = "lib";
+ std::string DirSep = "/";
const Triple HostTriple(Triple::normalize(LLVM_HOST_TRIPLE));
if (HostTriple.isOSWindows()) {
SharedExt = "dll";
@@ -449,7 +450,7 @@ int main(int argc, char **argv) {
// already has the necessary prefix and suffix (e.g. `.so`) added so
// just return it unmodified.
assert(Lib.endswith(SharedExt) && "DyLib is missing suffix");
- LibFileName = Lib;
+ LibFileName = std::string(Lib);
} else {
LibFileName = (SharedPrefix + Lib + "." + SharedExt).str();
}