[libcxx-commits] [libcxxabi] [libcxx] [ASan][libc++] std::basic_string annotations (PR #72677)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 12 10:33:43 PST 2023


================
@@ -642,6 +654,13 @@ get_sanitizer_flags(SANITIZER_FLAGS "${LLVM_USE_SANITIZER}")
 add_library(cxx-sanitizer-flags INTERFACE)
 target_compile_options(cxx-sanitizer-flags INTERFACE ${SANITIZER_FLAGS})
 
+# _LIBCPP_INSTRUMENTED_WITH_ASAN informs that library was built with ASan.
+string(FIND "${LLVM_USE_SANITIZER}" "Address" building_with_asan)
+if (NOT "${building_with_asan}" STREQUAL "-1")
+  set(LIBCPP_SANITIZER_DEFINES "#define _LIBCPP_INSTRUMENTED_WITH_ASAN 1")
+  config_define(${LIBCPP_SANITIZER_DEFINES} _LIBCPP_SANITIZER_DEFINES)
----------------
ldionne wrote:

Let's just do this instead:

```
config_define(ON _LIBCPP_INSTRUMENTED_WITH_ASAN)
```

Then you don't need `@_LIBCPP_SANITIZER_DEFINES@` below at all.

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


More information about the libcxx-commits mailing list