[compiler-rt] [asan][win][msvc] override new and delete and seperate TUs (PR #68754)

Charlie Barto via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 14:51:12 PST 2023


================
@@ -0,0 +1,46 @@
+//===-- asan_win_delete_array_thunk.cc ------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a part of AddressSanitizer, an address sanity checker.
+//
+// Windows-specific user-provided new/delete operator detection and fallback.
+//===----------------------------------------------------------------------===//
+#include "asan_win_new_delete_thunk_common.h"
+
+////////////////////////////////////////////////////////////////
+// clang-format off
+// delete() Fallback Ordering
+//
+// +-------------+
+// |delete_scalar<----+-----------------------+
+// +--^----------+    |                       |
+//    |               |                       |
+// +--+---------+  +--+---------------+  +----+----------------+
+// |DELETE_ARRAY|  |delete_scalar_size|  |delete_scalar_nothrow|
+// +--^----^----+  +------------------+  +---------------------+
+//    |    |
+//    |    +-------------------+
+//    |                        |
+// +--+--------------+  +------+-------------+
+// |delete_array_size|  |delete_array_nothrow|
+// +-----------------+  +--------------------+
+// clang-format on
+
+__asan_InitDefine<op_delete_array> init_delete_array;
+
+extern "C" void __cdecl __asan_delete_array(void* ptr);
----------------
barcharcraz wrote:

No, this would strictly increase the scopes it's visible from. 

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


More information about the llvm-commits mailing list