[clang] Headers: prefer `corecrt_malloc.h` to `malloc.h` (PR #131668)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 17 13:32:52 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: Saleem Abdulrasool (compnerd)

<details>
<summary>Changes</summary>

This allows us to target a lower level library (corecrt) rather than the higher level library (ucrt) which can be helpful in mordularising the SDK.

---
Full diff: https://github.com/llvm/llvm-project/pull/131668.diff


1 Files Affected:

- (modified) clang/lib/Headers/mm_malloc.h (+1-1) 


``````````diff
diff --git a/clang/lib/Headers/mm_malloc.h b/clang/lib/Headers/mm_malloc.h
index d32fe59416277..4052995fff5cd 100644
--- a/clang/lib/Headers/mm_malloc.h
+++ b/clang/lib/Headers/mm_malloc.h
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 
 #ifdef _WIN32
-#include <malloc.h>
+#include <corecrt_malloc.h>
 #else
 #ifndef __cplusplus
 extern int posix_memalign(void **__memptr, size_t __alignment, size_t __size);

``````````

</details>


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


More information about the cfe-commits mailing list