[llvm] 59ae182 - Remove unnecessary StringRef convesion in llvm-config

John Ericson via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 8 18:16:38 PDT 2021


Author: John Ericson
Date: 2021-10-08T21:16:32-04:00
New Revision: 59ae182bc248ffd7d9aa5d7b154b3feddbb74146

URL: https://github.com/llvm/llvm-project/commit/59ae182bc248ffd7d9aa5d7b154b3feddbb74146
DIFF: https://github.com/llvm/llvm-project/commit/59ae182bc248ffd7d9aa5d7b154b3feddbb74146.diff

LOG: Remove unnecessary StringRef convesion in llvm-config

We have a string litteral (via CPP) used to construct `StringRef`, which
is used to construct a `SmallString`. Just construct the latter
directly.

Differential Revision: https://reviews.llvm.org/D111322

Added: 
    

Modified: 
    llvm/tools/llvm-config/llvm-config.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp
index 1a2f04552d137..8afd3593272f5 100644
--- a/llvm/tools/llvm-config/llvm-config.cpp
+++ b/llvm/tools/llvm-config/llvm-config.cpp
@@ -358,7 +358,7 @@ int main(int argc, char **argv) {
   } else {
     ActivePrefix = CurrentExecPrefix;
     ActiveIncludeDir = ActivePrefix + "/include";
-    SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
+    SmallString<256> path(LLVM_TOOLS_INSTALL_DIR);
     sys::fs::make_absolute(ActivePrefix, path);
     ActiveBinDir = std::string(path.str());
     ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;


        


More information about the llvm-commits mailing list