[clang] Fix --print-libgcc-file-name on Darwin platforms (PR #98325)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 10 07:14:50 PDT 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 f50f7a7aa0b897ef91361d7dc159f3262d142bdc bbd66df28f451b79dccf6c879e355e2f555e48cd -- clang/test/Driver/darwin-print-libgcc-file-name.c clang/include/clang/Driver/Driver.h clang/lib/Driver/Driver.cpp clang/lib/Driver/ToolChains/Darwin.cpp clang/lib/Driver/ToolChains/Darwin.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index c2e90a5c0e..6933d17585 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -1273,7 +1273,7 @@ void MachO::AddLinkRuntimeLib(const ArgList &Args, ArgStringList &CmdArgs,
StringRef Component, RuntimeLinkOptions Opts,
bool IsShared) const {
std::string P = getCompilerRT(
- Args, Component, IsShared ? ToolChain::FT_Shared : ToolChain::FT_Static);
+ Args, Component, IsShared ? ToolChain::FT_Shared : ToolChain::FT_Static);
// For now, allow missing resource libraries to support developers who may
// not have compiler-rt checked out or integrated into their build (unless
@@ -1295,8 +1295,8 @@ void MachO::AddLinkRuntimeLib(const ArgList &Args, ArgStringList &CmdArgs,
CmdArgs.push_back("-rpath");
CmdArgs.push_back("@executable_path");
- // Add the compiler-rt library's directory to rpath to support using the dylib
- // from the default location without copying.
+ // Add the compiler-rt library's directory to rpath to support using the
+ // dylib from the default location without copying.
CmdArgs.push_back("-rpath");
CmdArgs.push_back(Args.MakeArgString(llvm::sys::path::parent_path(P)));
}
@@ -1315,12 +1315,13 @@ std::string MachO::getCompilerRT(const ArgList &, StringRef Component,
MachOLibName += Type == ToolChain::FT_Shared ? "_dynamic.dylib" : ".a";
SmallString<128> FullPath(getDriver().ResourceDir);
- llvm::sys::path::append(FullPath, "lib", "darwin", "macho_embedded", MachOLibName);
+ llvm::sys::path::append(FullPath, "lib", "darwin", "macho_embedded",
+ MachOLibName);
return std::string(FullPath);
}
std::string Darwin::getCompilerRT(const ArgList &, StringRef Component,
- FileType Type) const {
+ FileType Type) const {
assert(Type != ToolChain::FT_Object &&
"it doesn't make sense to ask for the compiler-rt library name as an "
"object file");
diff --git a/clang/lib/Driver/ToolChains/Darwin.h b/clang/lib/Driver/ToolChains/Darwin.h
index ba5a732df1..2d570a11e2 100644
--- a/clang/lib/Driver/ToolChains/Darwin.h
+++ b/clang/lib/Driver/ToolChains/Darwin.h
@@ -225,8 +225,9 @@ public:
// Return the full path of the compiler-rt library on a Darwin MachO system.
// Those are under <resourcedir>/lib/darwin/<...>(.dylib|.a).
- std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
- FileType Type = ToolChain::FT_Static) const override;
+ std::string
+ getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
+ FileType Type = ToolChain::FT_Static) const override;
/// }
/// @name ToolChain Implementation
@@ -363,8 +364,10 @@ public:
// Return the full path of the compiler-rt library on a Darwin MachO system.
// Those are under <resourcedir>/lib/darwin/<...>(.dylib|.a).
- std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
- FileType Type = ToolChain::FT_Static) const override;
+ std::string
+ getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
+ FileType Type = ToolChain::FT_Static) const override;
+
protected:
/// }
/// @name Darwin specific Toolchain functions
``````````
</details>
https://github.com/llvm/llvm-project/pull/98325
More information about the cfe-commits
mailing list