[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 5 06:12:16 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 3740fac0d4640c05ba960be97d14cbd375a7c733 b1bd1ee4f3a4966b50e0b35fd349091660e84576 --extensions c,cpp,h -- clang/test/Driver/arm-gnutools.c clang/lib/Driver/Driver.cpp clang/lib/Driver/ToolChains/BareMetal.cpp clang/lib/Driver/ToolChains/BareMetal.h clang/test/Driver/baremetal-sysroot.cpp clang/test/Driver/baremetal.cpp clang/test/Driver/riscv-args.c clang/test/Driver/riscv32-toolchain-extra.c clang/test/Driver/riscv32-toolchain.c clang/test/Driver/riscv64-toolchain-extra.c clang/test/Driver/riscv64-toolchain.c
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index c5185ccedd..543ed9e301 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -6521,7 +6521,7 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
break;
case llvm::Triple::riscv32:
case llvm::Triple::riscv64:
- TC = std::make_unique<toolchains::BareMetal>(*this, Target, Args);
+ TC = std::make_unique<toolchains::BareMetal>(*this, Target, Args);
break;
case llvm::Triple::ve:
TC = std::make_unique<toolchains::VEToolChain>(*this, Target, Args);
diff --git a/clang/lib/Driver/ToolChains/BareMetal.cpp b/clang/lib/Driver/ToolChains/BareMetal.cpp
index 1d065562e9..6bc3d7e926 100644
--- a/clang/lib/Driver/ToolChains/BareMetal.cpp
+++ b/clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -113,7 +113,8 @@ static std::string computeInstalledToolchainSysRoot(const Driver &D,
// GCC sysroot here means form sysroot from either --gcc-install-dir, or from
// --gcc-toolchain or if the toolchain is installed alongside clang in
-// bin/../<TargetTriple> directory if it is not explicitly specified on the command
+// bin/../<TargetTriple> directory if it is not explicitly specified on the
+// command
// line through `--sysroot` option. libc here will be newlib.
std::string BareMetal::computeGCCSysRoot() const {
if (!getDriver().SysRoot.empty())
@@ -169,10 +170,11 @@ static void addMultilibsFilePaths(const Driver &D, const MultilibSet &Multilibs,
BareMetal::BareMetal(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args)
- : Generic_ELF(D, Triple, Args){
+ : Generic_ELF(D, Triple, Args) {
GCCInstallation.init(Triple, Args);
SysRoot = computeSysRoot();
- UseLD = Args.getLastArgValue(options::OPT_fuse_ld_EQ).equals_insensitive("ld");
+ UseLD =
+ Args.getLastArgValue(options::OPT_fuse_ld_EQ).equals_insensitive("ld");
if (GCCInstallation.isValid()) {
Multilibs = GCCInstallation.getMultilibs();
SelectedMultilibs.assign({GCCInstallation.getMultilib()});
@@ -389,7 +391,7 @@ BareMetal::GetUnwindLibType(const llvm::opt::ArgList &Args) const {
}
const char *BareMetal::getDefaultLinker() const {
- if(isUsingLD())
+ if (isUsingLD())
return "ld";
return "ld.lld";
}
@@ -436,8 +438,8 @@ void BareMetal::addLibStdCxxIncludePaths(
StringRef TripleStr = GCCInstallation.getTriple().str();
const Multilib &Multilib = GCCInstallation.getMultilib();
addLibStdCXXIncludePaths(computeSysRoot() + "/include/c++/" + Version.Text,
- TripleStr, Multilib.includeSuffix(), DriverArgs,
- CC1Args);
+ TripleStr, Multilib.includeSuffix(), DriverArgs,
+ CC1Args);
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/118809
More information about the cfe-commits
mailing list