[PATCH] D134454: [Driver][Distro] Fix ArchLinux sysroot detection

Adrian Ratiu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 29 06:16:17 PDT 2022


10ne1 marked 7 inline comments as done.
10ne1 added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Linux.cpp:363
   const StringRef TripleStr = GCCInstallation.getTriple().str();
-  const Multilib &Multilib = GCCInstallation.getMultilib();
+  std::string Path = (InstallDir + "/../../../../" + TripleStr).str();
 
----------------
nickdesaulniers wrote:
> With all of the string concatenation going on, I wonder if `Path` should be a `Twine`?  `llvm::vfs::Filesystem::exists` accepts a `const Twine&`.  That avoids multiple reallocations and copies, and does one lazily.
> 
> (Every time I've tried to use `Twine`, I wind up with either `-Wdangling-gsl` or segfaults though! Still, please give it a shot.)
I tried making Twine work but I got many errors, couldn't even make it build. Looks like twine doesn't have `+=` operator for strings, and I also got many `error: use of deleted function ‘llvm::Twine& llvm::Twine::operator=(const llvm::Twine&)’`. C++ is such a mystery language.

Please let's just leave it a string for now, it's enough cleanups. :) Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134454/new/

https://reviews.llvm.org/D134454



More information about the cfe-commits mailing list