[PATCH] D131225: Driver: Refactor and support per target dirs in baremetal

Manoj Gupta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 13:00:48 PDT 2022


manojgupta added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/BareMetal.cpp:228-237
+  case ToolChain::RLT_CompilerRT: {
+    const std::string fileName = getCompilerRT(Args, "builtins");
+    std::string baseName = llvm::sys::path::filename(fileName).str();
+    llvm::StringRef baseNameRef(baseName);
+    baseNameRef.consume_front("lib");
+    baseNameRef.consume_back(".a");
     CmdArgs.push_back(
----------------
barannikov88 wrote:
> There are a few style issues.
> * `return` is usually within the braces
> * Variable names should start with capital letter
> * Looks like std::string could be avoided completely in favor of `StringRef` and `Twine`
> 
> Same applies to ConstructJob below, there are also redundant braces in `for` statement.
Addressed most.
std::string is needed initially to avoid dangling storage issue:

warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl]


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131225



More information about the llvm-commits mailing list