aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2024-12-18 10:37:44 -0800
committerGitHub <noreply@github.com>2024-12-18 10:37:44 -0800
commit9af5de320b77d3757ea2b7e3d85c67f88dfbabb5 (patch)
tree81175f3690602abfde2fa53e2b36d0a03a25617a /clang/lib
parent1a87f07465d76c87ace25623c67faf9596bbbf56 (diff)
downloadllvm-9af5de320b77d3757ea2b7e3d85c67f88dfbabb5.zip
llvm-9af5de320b77d3757ea2b7e3d85c67f88dfbabb5.tar.gz
llvm-9af5de320b77d3757ea2b7e3d85c67f88dfbabb5.tar.bz2
[driver] Fix sanitizer libc++ runtime linking (#120370)
1. -f[no-]sanitize-link-c++-runtime suppose to override defauld behavior implied from `CCCIsCXX` 2. Take into account -nostdlib++ (unblocks #108357) 3. Fix typo hasFlag vs hasArg.
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/SanitizerArgs.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp
index 81f94f2..0edfe64 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -1098,10 +1098,11 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
options::OPT_fno_sanitize_link_runtime, LinkRuntimes);
// Parse -link-cxx-sanitizer flag.
- LinkCXXRuntimes = Args.hasArg(options::OPT_fsanitize_link_cxx_runtime,
- options::OPT_fno_sanitize_link_cxx_runtime,
- LinkCXXRuntimes) ||
- D.CCCIsCXX();
+ LinkCXXRuntimes =
+ D.CCCIsCXX() && !Args.hasArg(clang::driver::options::OPT_nostdlibxx);
+ LinkCXXRuntimes =
+ Args.hasFlag(options::OPT_fsanitize_link_cxx_runtime,
+ options::OPT_fno_sanitize_link_cxx_runtime, LinkCXXRuntimes);
NeedsMemProfRt = Args.hasFlag(options::OPT_fmemory_profile,
options::OPT_fmemory_profile_EQ,