[libcxx-commits] [libcxx] [libcxxabi] [libunwind] [llvm] [runtimes] Probe for -nostdlib++ and -nostdinc++ with the C compiler (PR #108357)

Vitaly Buka via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 17 19:49:49 PST 2024


vitalybuka wrote:

```
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp
index 89f1215afd0c..234c28bfd2c3 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -1083,10 +1083,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 =
+      Args.hasFlag(options::OPT_fsanitize_link_cxx_runtime,
+                  options::OPT_fno_sanitize_link_cxx_runtime,
+                  LinkCXXRuntimes) ||
+      (D.CCCIsCXX() && !Args.hasArg(clang::driver::options::OPT_nostdlibxx))  ;
 
   NeedsMemProfRt = Args.hasFlag(options::OPT_fmemory_profile,
                                 options::OPT_fmemory_profile_EQ,
```

@petrhosek  `Args.hasArg` looks like a typo in https://reviews.llvm.org/D65029 ?

https://github.com/llvm/llvm-project/pull/108357


More information about the libcxx-commits mailing list