[all-commits] [llvm/llvm-project] 9abb34: [Darwin][Driver] Avoid duplicate -lc++ with -fsani...

Andrew Haberlandt via All-commits all-commits at lists.llvm.org
Thu Oct 9 01:38:50 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9abb344e572e165f01d7789522113d9a4d8b0ca6
      https://github.com/llvm/llvm-project/commit/9abb344e572e165f01d7789522113d9a4d8b0ca6
  Author: Andrew Haberlandt <ndrewh at users.noreply.github.com>
  Date:   2025-10-09 (Thu, 09 Oct 2025)

  Changed paths:
    M clang/lib/Driver/ToolChains/Darwin.cpp

  Log Message:
  -----------
  [Darwin][Driver] Avoid duplicate -lc++ with -fsanitize=fuzzer (#161304)

On Darwin, duplicate `-l` options cause a warning to be printed.

Invoking clang as clang++ and using `-fsanitize=fuzzer` will cause `-lc++`
to be passed twice to the linker, causing a warning.

i.e. AddCXXStdlibLibArgs is called twice in this case:

1)
https://github.com/llvm/llvm-project/blob/19c4e86f3e8582c3f087a9fec5ac036838e58ec4/clang/lib/Driver/ToolChains/Darwin.cpp#L743
because `ShouldLinkCXXStdlib(Args)` is true.
2) The subject of this PR

We now skip adding the -lc++ argument if `ShouldLinkCXXStdlib(Args)`
(since that means the other path already added it).

rdar://136431775



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list