[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-04-27 Thread Pengcheng Wang via cfe-commits

https://github.com/wangpc-pp created 
https://github.com/llvm/llvm-project/pull/90373

Since C++14 has been released for about nine years and most standard
libraries have implemented sized deallocation functions, it's time to
make this feature default again.

This is another try of https://reviews.llvm.org/D112921.

The original commit cf5a8b4 was reverted by 2e5035a due to some
failures (see #83774).

Fixes #60061


>From cc722438155619cb0524eb26191be0465ccddbf0 Mon Sep 17 00:00:00 2001
From: Pengcheng Wang 
Date: Fri, 26 Apr 2024 16:59:12 +0800
Subject: [PATCH] [clang] Enable sized deallocation by default in C++14 onwards

Since C++14 has been released for about nine years and most standard
libraries have implemented sized deallocation functions, it's time to
make this feature default again.

This is another try of https://reviews.llvm.org/D112921.

The original commit cf5a8b4 was reverted by 2e5035a due to some
failures (see #83774).

Fixes #60061
---
 .../clangd/unittests/FindTargetTests.cpp  |   4 +-
 .../checkers/misc/new-delete-overloads.cpp|  10 -
 clang/docs/ReleaseNotes.rst   |   5 +
 clang/include/clang/Driver/Options.td |   8 +-
 clang/lib/Driver/ToolChains/Clang.cpp |  13 +-
 clang/lib/Driver/ToolChains/Darwin.cpp|  58 -
 clang/lib/Driver/ToolChains/Darwin.h  |   4 +
 clang/lib/Driver/ToolChains/ZOS.cpp   |   6 +
 clang/test/AST/ast-dump-expr-json.cpp |   2 +-
 clang/test/AST/ast-dump-expr.cpp  |   2 +-
 clang/test/AST/ast-dump-stmt-json.cpp | 244 +-
 clang/test/Analysis/cxxnewexpr-callback.cpp   |   4 +-
 .../basic.stc.dynamic.deallocation/p2.cpp |   2 +-
 clang/test/CXX/drs/cwg292.cpp |  17 +-
 .../test/CXX/expr/expr.unary/expr.new/p14.cpp |   2 +-
 .../CodeGenCXX/cxx1y-sized-deallocation.cpp   |  10 +-
 .../CodeGenCXX/cxx1z-aligned-allocation.cpp   |   6 +-
 .../CodeGenCXX/cxx2a-destroying-delete.cpp|   4 +-
 clang/test/CodeGenCXX/delete-two-arg.cpp  |   4 +-
 clang/test/CodeGenCXX/delete.cpp  |  12 +-
 clang/test/CodeGenCXX/dllimport.cpp   |   4 +-
 clang/test/CodeGenCXX/new.cpp |   6 +-
 .../coro-aligned-alloc-2.cpp  |   2 -
 .../CodeGenCoroutines/coro-aligned-alloc.cpp  |   6 +-
 clang/test/CodeGenCoroutines/coro-alloc.cpp   |   6 +-
 clang/test/CodeGenCoroutines/coro-cleanup.cpp |   6 +-
 clang/test/CodeGenCoroutines/coro-dealloc.cpp |   2 -
 clang/test/CodeGenCoroutines/coro-gro.cpp |   3 +-
 clang/test/CodeGenCoroutines/pr56919.cpp  |   9 +-
 clang/test/Lexer/cxx-features.cpp |  20 +-
 clang/test/PCH/cxx1z-aligned-alloc.cpp|  10 +-
 clang/test/SemaCXX/MicrosoftExtensions.cpp|   8 +-
 .../SemaCXX/builtin-operator-new-delete.cpp   |   2 +-
 .../test/SemaCXX/cxx1y-sized-deallocation.cpp |   2 +-
 .../unavailable_aligned_allocation.cpp|  15 +-
 clang/tools/clang-repl/CMakeLists.txt |  43 +++
 clang/unittests/Interpreter/CMakeLists.txt|  43 +++
 .../StaticAnalyzer/CallEventTest.cpp  |   2 +-
 clang/www/cxx_status.html |  11 +-
 .../support.dynamic/libcpp_deallocate.sh.cpp  |   3 +
 .../sized_delete_array14.pass.cpp |   8 +-
 .../new.delete.single/sized_delete14.pass.cpp |   8 +-
 42 files changed, 523 insertions(+), 113 deletions(-)

diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp 
b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index 799a549ff0816e..88aae2729904f4 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -839,7 +839,9 @@ TEST_F(TargetDeclTest, OverloadExpr) {
   [[delete]] x;
 }
   )cpp";
-  EXPECT_DECLS("CXXDeleteExpr", "void operator delete(void *) noexcept");
+  // Sized deallocation is enabled by default in C++14 onwards.
+  EXPECT_DECLS("CXXDeleteExpr",
+   "void operator delete(void *, unsigned long) noexcept");
 }
 
 TEST_F(TargetDeclTest, DependentExprs) {
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
index 78f021144b2e19..f86fe8a4c5b14f 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
@@ -12,16 +12,6 @@ struct S {
 // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: declaration of 'operator new' has 
no matching declaration of 'operator delete' at the same scope
 void *operator new(size_t size) noexcept(false);
 
-struct T {
-  // Sized deallocations are not enabled by default, and so this new/delete 
pair
-  // does not match. However, we expect only one warning, for the new, because
-  // the operator delete is a placement delete and we do not warn on 
mismatching
-  // placement operations.
-  // CHECK-MESSAGES: :[[@LINE+1]]:9: warning: de

[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-04-27 Thread via cfe-commits

llvmbot wrote:



@llvm/pr-subscribers-coroutines

@llvm/pr-subscribers-libcxx

Author: Pengcheng Wang (wangpc-pp)


Changes

Since C++14 has been released for about nine years and most standard
libraries have implemented sized deallocation functions, it's time to
make this feature default again.

This is another try of https://reviews.llvm.org/D112921.

The original commit cf5a8b4 was reverted by 2e5035a due to some
failures (see #83774).

Fixes #60061


---

Patch is 56.61 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/90373.diff


42 Files Affected:

- (modified) clang-tools-extra/clangd/unittests/FindTargetTests.cpp (+3-1) 
- (modified) 
clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp (-10) 
- (modified) clang/docs/ReleaseNotes.rst (+5) 
- (modified) clang/include/clang/Driver/Options.td (+4-4) 
- (modified) clang/lib/Driver/ToolChains/Clang.cpp (+9-4) 
- (modified) clang/lib/Driver/ToolChains/Darwin.cpp (+55-3) 
- (modified) clang/lib/Driver/ToolChains/Darwin.h (+4) 
- (modified) clang/lib/Driver/ToolChains/ZOS.cpp (+6) 
- (modified) clang/test/AST/ast-dump-expr-json.cpp (+1-1) 
- (modified) clang/test/AST/ast-dump-expr.cpp (+1-1) 
- (modified) clang/test/AST/ast-dump-stmt-json.cpp (+241-3) 
- (modified) clang/test/Analysis/cxxnewexpr-callback.cpp (+2-2) 
- (modified) 
clang/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p2.cpp
 (+1-1) 
- (modified) clang/test/CXX/drs/cwg292.cpp (+9-8) 
- (modified) clang/test/CXX/expr/expr.unary/expr.new/p14.cpp (+1-1) 
- (modified) clang/test/CodeGenCXX/cxx1y-sized-deallocation.cpp (+5-5) 
- (modified) clang/test/CodeGenCXX/cxx1z-aligned-allocation.cpp (+3-3) 
- (modified) clang/test/CodeGenCXX/cxx2a-destroying-delete.cpp (+2-2) 
- (modified) clang/test/CodeGenCXX/delete-two-arg.cpp (+3-1) 
- (modified) clang/test/CodeGenCXX/delete.cpp (+7-5) 
- (modified) clang/test/CodeGenCXX/dllimport.cpp (+2-2) 
- (modified) clang/test/CodeGenCXX/new.cpp (+3-3) 
- (modified) clang/test/CodeGenCoroutines/coro-aligned-alloc-2.cpp (-2) 
- (modified) clang/test/CodeGenCoroutines/coro-aligned-alloc.cpp (+4-2) 
- (modified) clang/test/CodeGenCoroutines/coro-alloc.cpp (+4-2) 
- (modified) clang/test/CodeGenCoroutines/coro-cleanup.cpp (+4-2) 
- (modified) clang/test/CodeGenCoroutines/coro-dealloc.cpp (-2) 
- (modified) clang/test/CodeGenCoroutines/coro-gro.cpp (+2-1) 
- (modified) clang/test/CodeGenCoroutines/pr56919.cpp (+6-3) 
- (modified) clang/test/Lexer/cxx-features.cpp (+10-10) 
- (modified) clang/test/PCH/cxx1z-aligned-alloc.cpp (+5-5) 
- (modified) clang/test/SemaCXX/MicrosoftExtensions.cpp (+7-1) 
- (modified) clang/test/SemaCXX/builtin-operator-new-delete.cpp (+1-1) 
- (modified) clang/test/SemaCXX/cxx1y-sized-deallocation.cpp (+1-1) 
- (modified) clang/test/SemaCXX/unavailable_aligned_allocation.cpp (+9-6) 
- (modified) clang/tools/clang-repl/CMakeLists.txt (+43) 
- (modified) clang/unittests/Interpreter/CMakeLists.txt (+43) 
- (modified) clang/unittests/StaticAnalyzer/CallEventTest.cpp (+1-1) 
- (modified) clang/www/cxx_status.html (+5-6) 
- (modified) 
libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp 
(+3) 
- (modified) 
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
 (+4-4) 
- (modified) 
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
 (+4-4) 


``diff
diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp 
b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index 799a549ff0816e..88aae2729904f4 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -839,7 +839,9 @@ TEST_F(TargetDeclTest, OverloadExpr) {
   [[delete]] x;
 }
   )cpp";
-  EXPECT_DECLS("CXXDeleteExpr", "void operator delete(void *) noexcept");
+  // Sized deallocation is enabled by default in C++14 onwards.
+  EXPECT_DECLS("CXXDeleteExpr",
+   "void operator delete(void *, unsigned long) noexcept");
 }
 
 TEST_F(TargetDeclTest, DependentExprs) {
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
index 78f021144b2e19..f86fe8a4c5b14f 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
@@ -12,16 +12,6 @@ struct S {
 // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: declaration of 'operator new' has 
no matching declaration of 'operator delete' at the same scope
 void *operator new(size_t size) noexcept(false);
 
-struct T {
-  // Sized deallocations are not enabled by default, and so this new/delete 
pair
-  // does not match. However, we expect only one warning, for the new, because
-  // the operator delete is a placement delete and we do 

[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-04-27 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-tidy

Author: Pengcheng Wang (wangpc-pp)


Changes

Since C++14 has been released for about nine years and most standard
libraries have implemented sized deallocation functions, it's time to
make this feature default again.

This is another try of https://reviews.llvm.org/D112921.

The original commit cf5a8b4 was reverted by 2e5035a due to some
failures (see #83774).

Fixes #60061


---

Patch is 56.61 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/90373.diff


42 Files Affected:

- (modified) clang-tools-extra/clangd/unittests/FindTargetTests.cpp (+3-1) 
- (modified) 
clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp (-10) 
- (modified) clang/docs/ReleaseNotes.rst (+5) 
- (modified) clang/include/clang/Driver/Options.td (+4-4) 
- (modified) clang/lib/Driver/ToolChains/Clang.cpp (+9-4) 
- (modified) clang/lib/Driver/ToolChains/Darwin.cpp (+55-3) 
- (modified) clang/lib/Driver/ToolChains/Darwin.h (+4) 
- (modified) clang/lib/Driver/ToolChains/ZOS.cpp (+6) 
- (modified) clang/test/AST/ast-dump-expr-json.cpp (+1-1) 
- (modified) clang/test/AST/ast-dump-expr.cpp (+1-1) 
- (modified) clang/test/AST/ast-dump-stmt-json.cpp (+241-3) 
- (modified) clang/test/Analysis/cxxnewexpr-callback.cpp (+2-2) 
- (modified) 
clang/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p2.cpp
 (+1-1) 
- (modified) clang/test/CXX/drs/cwg292.cpp (+9-8) 
- (modified) clang/test/CXX/expr/expr.unary/expr.new/p14.cpp (+1-1) 
- (modified) clang/test/CodeGenCXX/cxx1y-sized-deallocation.cpp (+5-5) 
- (modified) clang/test/CodeGenCXX/cxx1z-aligned-allocation.cpp (+3-3) 
- (modified) clang/test/CodeGenCXX/cxx2a-destroying-delete.cpp (+2-2) 
- (modified) clang/test/CodeGenCXX/delete-two-arg.cpp (+3-1) 
- (modified) clang/test/CodeGenCXX/delete.cpp (+7-5) 
- (modified) clang/test/CodeGenCXX/dllimport.cpp (+2-2) 
- (modified) clang/test/CodeGenCXX/new.cpp (+3-3) 
- (modified) clang/test/CodeGenCoroutines/coro-aligned-alloc-2.cpp (-2) 
- (modified) clang/test/CodeGenCoroutines/coro-aligned-alloc.cpp (+4-2) 
- (modified) clang/test/CodeGenCoroutines/coro-alloc.cpp (+4-2) 
- (modified) clang/test/CodeGenCoroutines/coro-cleanup.cpp (+4-2) 
- (modified) clang/test/CodeGenCoroutines/coro-dealloc.cpp (-2) 
- (modified) clang/test/CodeGenCoroutines/coro-gro.cpp (+2-1) 
- (modified) clang/test/CodeGenCoroutines/pr56919.cpp (+6-3) 
- (modified) clang/test/Lexer/cxx-features.cpp (+10-10) 
- (modified) clang/test/PCH/cxx1z-aligned-alloc.cpp (+5-5) 
- (modified) clang/test/SemaCXX/MicrosoftExtensions.cpp (+7-1) 
- (modified) clang/test/SemaCXX/builtin-operator-new-delete.cpp (+1-1) 
- (modified) clang/test/SemaCXX/cxx1y-sized-deallocation.cpp (+1-1) 
- (modified) clang/test/SemaCXX/unavailable_aligned_allocation.cpp (+9-6) 
- (modified) clang/tools/clang-repl/CMakeLists.txt (+43) 
- (modified) clang/unittests/Interpreter/CMakeLists.txt (+43) 
- (modified) clang/unittests/StaticAnalyzer/CallEventTest.cpp (+1-1) 
- (modified) clang/www/cxx_status.html (+5-6) 
- (modified) 
libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp 
(+3) 
- (modified) 
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
 (+4-4) 
- (modified) 
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
 (+4-4) 


``diff
diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp 
b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index 799a549ff0816e..88aae2729904f4 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -839,7 +839,9 @@ TEST_F(TargetDeclTest, OverloadExpr) {
   [[delete]] x;
 }
   )cpp";
-  EXPECT_DECLS("CXXDeleteExpr", "void operator delete(void *) noexcept");
+  // Sized deallocation is enabled by default in C++14 onwards.
+  EXPECT_DECLS("CXXDeleteExpr",
+   "void operator delete(void *, unsigned long) noexcept");
 }
 
 TEST_F(TargetDeclTest, DependentExprs) {
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
index 78f021144b2e19..f86fe8a4c5b14f 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
@@ -12,16 +12,6 @@ struct S {
 // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: declaration of 'operator new' has 
no matching declaration of 'operator delete' at the same scope
 void *operator new(size_t size) noexcept(false);
 
-struct T {
-  // Sized deallocations are not enabled by default, and so this new/delete 
pair
-  // does not match. However, we expect only one warning, for the new, because
-  // the operator delete is a placement delete and we do not warn on 
mismatching
-  

[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-04-27 Thread Pengcheng Wang via cfe-commits

wangpc-pp wrote:

@dyung Can you help me to comfirm whether the Windows builder is passing now? I 
don't have such environment. Thanks in advance!

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-04-27 Thread via cfe-commits

dyung wrote:

> @dyung Can you help me to comfirm whether the Windows builder is passing now? 
> I don't have such environment. Thanks in advance!

Sure, I'll try it on our internal builder and see if it passes and let you know 
the result.

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-04-28 Thread via cfe-commits

dyung wrote:

> > @dyung Can you help me to comfirm whether the Windows builder is passing 
> > now? I don't have such environment. Thanks in advance!
> 
> Sure, I'll try it on our internal builder and see if it passes and let you 
> know the result.

I can confirm that this change builds successfully on our Windows configuration.

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-04-28 Thread Pengcheng Wang via cfe-commits

wangpc-pp wrote:

> > > @dyung Can you help me to comfirm whether the Windows builder is passing 
> > > now? I don't have such environment. Thanks in advance!
> > 
> > 
> > Sure, I'll try it on our internal builder and see if it passes and let you 
> > know the result.
> 
> I can confirm that this change builds successfully on our Windows 
> configuration.

Thanks a lot, that was quick!
There is another AddressSanitizer issue that may possibly be fixed by 
https://github.com/llvm/llvm-project/pull/90292. cc @vitalybuka

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-04-30 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> Thanks a lot, that was quick! There is another AddressSanitizer issue that 
> may possibly be fixed by #90292. cc @vitalybuka

Yes, please wait for #90292.


https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-21 Thread Pengcheng Wang via cfe-commits

https://github.com/wangpc-pp updated 
https://github.com/llvm/llvm-project/pull/90373

>From fd015302585fc8149811868636cb0da5c422cf7a Mon Sep 17 00:00:00 2001
From: Pengcheng Wang 
Date: Fri, 26 Apr 2024 16:59:12 +0800
Subject: [PATCH] [clang] Enable sized deallocation by default in C++14 onwards

Since C++14 has been released for about nine years and most standard
libraries have implemented sized deallocation functions, it's time to
make this feature default again.

This is another try of https://reviews.llvm.org/D112921.

The original commit cf5a8b4 was reverted by 2e5035a due to some
failures (see #83774).

Fixes #60061
---
 .../clangd/unittests/FindTargetTests.cpp  |   4 +-
 .../checkers/misc/new-delete-overloads.cpp|  10 -
 clang/docs/ReleaseNotes.rst   |   5 +
 clang/include/clang/Driver/Options.td |   8 +-
 clang/lib/Driver/ToolChains/Clang.cpp |  13 +-
 clang/lib/Driver/ToolChains/Darwin.cpp|  58 -
 clang/lib/Driver/ToolChains/Darwin.h  |   4 +
 clang/lib/Driver/ToolChains/ZOS.cpp   |   6 +
 clang/test/AST/ast-dump-expr-json.cpp |   2 +-
 clang/test/AST/ast-dump-expr.cpp  |   2 +-
 clang/test/AST/ast-dump-stmt-json.cpp | 244 +-
 clang/test/Analysis/cxxnewexpr-callback.cpp   |   4 +-
 .../basic.stc.dynamic.deallocation/p2.cpp |   2 +-
 clang/test/CXX/drs/cwg292.cpp |  17 +-
 .../test/CXX/expr/expr.unary/expr.new/p14.cpp |   2 +-
 .../CodeGenCXX/cxx1y-sized-deallocation.cpp   |  10 +-
 .../CodeGenCXX/cxx1z-aligned-allocation.cpp   |   6 +-
 .../CodeGenCXX/cxx2a-destroying-delete.cpp|   4 +-
 clang/test/CodeGenCXX/delete-two-arg.cpp  |   4 +-
 clang/test/CodeGenCXX/delete.cpp  |  12 +-
 clang/test/CodeGenCXX/dllimport.cpp   |   4 +-
 clang/test/CodeGenCXX/new.cpp |   6 +-
 .../coro-aligned-alloc-2.cpp  |   2 -
 .../CodeGenCoroutines/coro-aligned-alloc.cpp  |   6 +-
 clang/test/CodeGenCoroutines/coro-alloc.cpp   |   6 +-
 clang/test/CodeGenCoroutines/coro-cleanup.cpp |   6 +-
 clang/test/CodeGenCoroutines/coro-dealloc.cpp |   2 -
 clang/test/CodeGenCoroutines/coro-gro.cpp |   3 +-
 clang/test/CodeGenCoroutines/pr56919.cpp  |   9 +-
 clang/test/Lexer/cxx-features.cpp |  20 +-
 clang/test/PCH/cxx1z-aligned-alloc.cpp|  10 +-
 clang/test/SemaCXX/MicrosoftExtensions.cpp|   8 +-
 .../SemaCXX/builtin-operator-new-delete.cpp   |   2 +-
 .../test/SemaCXX/cxx1y-sized-deallocation.cpp |   2 +-
 .../unavailable_aligned_allocation.cpp|  15 +-
 clang/tools/clang-repl/CMakeLists.txt |  43 +++
 clang/unittests/Interpreter/CMakeLists.txt|  43 +++
 .../StaticAnalyzer/CallEventTest.cpp  |   2 +-
 clang/www/cxx_status.html |  11 +-
 .../support.dynamic/libcpp_deallocate.sh.cpp  |   3 +
 .../sized_delete_array14.pass.cpp |   8 +-
 .../new.delete.single/sized_delete14.pass.cpp |   8 +-
 42 files changed, 523 insertions(+), 113 deletions(-)

diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp 
b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index 0b2273f0a9a6e..3220a5a6a9825 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -836,7 +836,9 @@ TEST_F(TargetDeclTest, OverloadExpr) {
   [[delete]] x;
 }
   )cpp";
-  EXPECT_DECLS("CXXDeleteExpr", "void operator delete(void *) noexcept");
+  // Sized deallocation is enabled by default in C++14 onwards.
+  EXPECT_DECLS("CXXDeleteExpr",
+   "void operator delete(void *, unsigned long) noexcept");
 }
 
 TEST_F(TargetDeclTest, DependentExprs) {
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
index 78f021144b2e1..f86fe8a4c5b14 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
@@ -12,16 +12,6 @@ struct S {
 // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: declaration of 'operator new' has 
no matching declaration of 'operator delete' at the same scope
 void *operator new(size_t size) noexcept(false);
 
-struct T {
-  // Sized deallocations are not enabled by default, and so this new/delete 
pair
-  // does not match. However, we expect only one warning, for the new, because
-  // the operator delete is a placement delete and we do not warn on 
mismatching
-  // placement operations.
-  // CHECK-MESSAGES: :[[@LINE+1]]:9: warning: declaration of 'operator new' 
has no matching declaration of 'operator delete' at the same scope
-  void *operator new(size_t size) noexcept;
-  void operator delete(void *ptr, size_t) noexcept; // ok only if sized 
deallocation is enabled
-};
-
 struct U {
   void *operator new(size_t size) noexcept;
   void operator delete(void *ptr) n

[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-21 Thread Pengcheng Wang via cfe-commits

wangpc-pp wrote:

Please review this PR as all noticable issues have been fixed I think.

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-21 Thread Louis Dionne via cfe-commits

https://github.com/ldionne approved this pull request.

Let's try this again. Thanks for your perseverance, this is obviously not easy 
to land but it's important to get it done. Let's hope everything has been 
addressed this time around.

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-21 Thread Pengcheng Wang via cfe-commits

https://github.com/wangpc-pp updated 
https://github.com/llvm/llvm-project/pull/90373

>From a18f57e23c0d4fd23647eb2ef610352e402b45f6 Mon Sep 17 00:00:00 2001
From: Pengcheng Wang 
Date: Fri, 26 Apr 2024 16:59:12 +0800
Subject: [PATCH] [clang] Enable sized deallocation by default in C++14 onwards

Since C++14 has been released for about nine years and most standard
libraries have implemented sized deallocation functions, it's time to
make this feature default again.

This is another try of https://reviews.llvm.org/D112921.

The original commit cf5a8b4 was reverted by 2e5035a due to some
failures (see #83774).

Fixes #60061
---
 .../clangd/unittests/FindTargetTests.cpp  |   4 +-
 .../checkers/misc/new-delete-overloads.cpp|  10 -
 clang/docs/ReleaseNotes.rst   |   5 +
 clang/include/clang/Driver/Options.td |   8 +-
 clang/lib/Driver/ToolChains/Clang.cpp |  13 +-
 clang/lib/Driver/ToolChains/Darwin.cpp|  58 -
 clang/lib/Driver/ToolChains/Darwin.h  |   4 +
 clang/lib/Driver/ToolChains/ZOS.cpp   |   6 +
 clang/test/AST/ast-dump-expr-json.cpp |   2 +-
 clang/test/AST/ast-dump-expr.cpp  |   2 +-
 clang/test/AST/ast-dump-stmt-json.cpp | 244 +-
 clang/test/Analysis/cxxnewexpr-callback.cpp   |   4 +-
 .../basic.stc.dynamic.deallocation/p2.cpp |   2 +-
 clang/test/CXX/drs/cwg292.cpp |  17 +-
 .../test/CXX/expr/expr.unary/expr.new/p14.cpp |   2 +-
 .../CodeGenCXX/cxx1y-sized-deallocation.cpp   |  10 +-
 .../CodeGenCXX/cxx1z-aligned-allocation.cpp   |   6 +-
 .../CodeGenCXX/cxx2a-destroying-delete.cpp|   4 +-
 clang/test/CodeGenCXX/delete-two-arg.cpp  |   4 +-
 clang/test/CodeGenCXX/delete.cpp  |  12 +-
 clang/test/CodeGenCXX/dllimport.cpp   |   4 +-
 clang/test/CodeGenCXX/new.cpp |   6 +-
 .../coro-aligned-alloc-2.cpp  |   2 -
 .../CodeGenCoroutines/coro-aligned-alloc.cpp  |   6 +-
 clang/test/CodeGenCoroutines/coro-alloc.cpp   |   6 +-
 clang/test/CodeGenCoroutines/coro-cleanup.cpp |   6 +-
 clang/test/CodeGenCoroutines/coro-dealloc.cpp |   2 -
 clang/test/CodeGenCoroutines/coro-gro.cpp |   3 +-
 clang/test/CodeGenCoroutines/pr56919.cpp  |   9 +-
 clang/test/Lexer/cxx-features.cpp |  20 +-
 clang/test/PCH/cxx1z-aligned-alloc.cpp|  10 +-
 clang/test/SemaCXX/MicrosoftExtensions.cpp|   8 +-
 .../SemaCXX/builtin-operator-new-delete.cpp   |   2 +-
 .../test/SemaCXX/cxx1y-sized-deallocation.cpp |   2 +-
 .../unavailable_aligned_allocation.cpp|  15 +-
 clang/tools/clang-repl/CMakeLists.txt |  43 +++
 clang/unittests/Interpreter/CMakeLists.txt|  43 +++
 .../StaticAnalyzer/CallEventTest.cpp  |   2 +-
 clang/www/cxx_status.html |  11 +-
 .../support.dynamic/libcpp_deallocate.sh.cpp  |   3 +
 .../sized_delete_array14.pass.cpp |   8 +-
 .../new.delete.single/sized_delete14.pass.cpp |   8 +-
 42 files changed, 523 insertions(+), 113 deletions(-)

diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp 
b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index 0b2273f0a9a6e..3220a5a6a9825 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -836,7 +836,9 @@ TEST_F(TargetDeclTest, OverloadExpr) {
   [[delete]] x;
 }
   )cpp";
-  EXPECT_DECLS("CXXDeleteExpr", "void operator delete(void *) noexcept");
+  // Sized deallocation is enabled by default in C++14 onwards.
+  EXPECT_DECLS("CXXDeleteExpr",
+   "void operator delete(void *, unsigned long) noexcept");
 }
 
 TEST_F(TargetDeclTest, DependentExprs) {
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
index 78f021144b2e1..f86fe8a4c5b14 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
@@ -12,16 +12,6 @@ struct S {
 // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: declaration of 'operator new' has 
no matching declaration of 'operator delete' at the same scope
 void *operator new(size_t size) noexcept(false);
 
-struct T {
-  // Sized deallocations are not enabled by default, and so this new/delete 
pair
-  // does not match. However, we expect only one warning, for the new, because
-  // the operator delete is a placement delete and we do not warn on 
mismatching
-  // placement operations.
-  // CHECK-MESSAGES: :[[@LINE+1]]:9: warning: declaration of 'operator new' 
has no matching declaration of 'operator delete' at the same scope
-  void *operator new(size_t size) noexcept;
-  void operator delete(void *ptr, size_t) noexcept; // ok only if sized 
deallocation is enabled
-};
-
 struct U {
   void *operator new(size_t size) noexcept;
   void operator delete(void *ptr) n

[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-21 Thread Pengcheng Wang via cfe-commits

https://github.com/wangpc-pp closed 
https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-22 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

This one is broken https://lab.llvm.org/buildbot/#/builders/168/builds/20461

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-22 Thread Pengcheng Wang via cfe-commits

wangpc-pp wrote:

> This one is broken https://lab.llvm.org/buildbot/#/builders/168/builds/20461

The broken case is:
```cpp
void test_allocate_deallocate() {
  std::pmr::memory_resource& r1 = *std::pmr::new_delete_resource();

  globalMemCounter.reset();

  void* ret = r1.allocate(50);
  assert(ret);
  
ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS(globalMemCounter.checkOutstandingNewEq(1));
  
ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS(globalMemCounter.checkLastNewSizeEq(50));

  r1.deallocate(ret, 1);
  assert(globalMemCounter.checkOutstandingNewEq(0));
  
ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS(globalMemCounter.checkDeleteCalledEq(1));
}
```
The errors are:
```
# .---command stderr
# | =
# | ==3452201==ERROR: AddressSanitizer: new-delete-type-mismatch on 
0x50600020 in thread T0:
# |   object passed to delete has wrong type:
# |   size of the allocated type:   50 bytes;
# |   size of the deallocated type: 1 bytes.
# | #0 0x565094abbd02  
(/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/test/std/utilities/utility/mem.res/mem.res.global/Output/new_delete_resource.pass.cpp.dir/t.tmp.exe+0x14ad02)
# | #1 0x565094abe168  
(/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/test/std/utilities/utility/mem.res/mem.res.global/Output/new_delete_resource.pass.cpp.dir/t.tmp.exe+0x14d168)
# | #2 0x565094abd941  
(/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/test/std/utilities/utility/mem.res/mem.res.global/Output/new_delete_resource.pass.cpp.dir/t.tmp.exe+0x14c941)
# | #3 0x565094abda24  
(/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/test/std/utilities/utility/mem.res/mem.res.global/Output/new_delete_resource.pass.cpp.dir/t.tmp.exe+0x14ca24)
# | #4 0x7f8643c2814f  (/lib/x86_64-linux-gnu/libc.so.6+0x2814f) (BuildId: 
b20cbdb62d7717c13dc61a48b7b2e673a7edf233)
# | #5 0x7f8643c28208  (/lib/x86_64-linux-gnu/libc.so.6+0x28208) (BuildId: 
b20cbdb62d7717c13dc61a48b7b2e673a7edf233)
# | #6 0x5650949dbed4  
(/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/test/std/utilities/utility/mem.res/mem.res.global/Output/new_delete_resource.pass.cpp.dir/t.tmp.exe+0x6aed4)
# | 
# | 0x50600020 is located 0 bytes inside of 50-byte region 
[0x50600020,0x50600052)
# | allocated by thread T0 here:
# | #0 0x565094abb09d  
(/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/test/std/utilities/utility/mem.res/mem.res.global/Output/new_delete_resource.pass.cpp.dir/t.tmp.exe+0x14a09d)
# | #1 0x565094abe098  
(/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/test/std/utilities/utility/mem.res/mem.res.global/Output/new_delete_resource.pass.cpp.dir/t.tmp.exe+0x14d098)
# | #2 0x565094abd83f  
(/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/test/std/utilities/utility/mem.res/mem.res.global/Output/new_delete_resource.pass.cpp.dir/t.tmp.exe+0x14c83f)
# | #3 0x565094abda24  
(/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/test/std/utilities/utility/mem.res/mem.res.global/Output/new_delete_resource.pass.cpp.dir/t.tmp.exe+0x14ca24)
# | #4 0x7f8643c2814f  (/lib/x86_64-linux-gnu/libc.so.6+0x2814f) (BuildId: 
b20cbdb62d7717c13dc61a48b7b2e673a7edf233)
# | 
# | SUMMARY: AddressSanitizer: new-delete-type-mismatch 
(/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/test/std/utilities/utility/mem.res/mem.res.global/Output/new_delete_resource.pass.cpp.dir/t.tmp.exe+0x14ad02)
 
# | ==3452201==HINT: if you don't care about these errors you may set 
ASAN_OPTIONS=new_delete_type_mismatch=0
# | ==3452201==ABORTING
# `-
# error: command failed with exit status: 1
```

Based on my rough understanding, this is expected? Because we allocate 50 bytes 
via `void* ret = r1.allocate(50);` and deallocate 1 byte via 
`r1.deallocate(ret, 1);`.

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-22 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> Based on my rough understanding, this is expected?

What do you mean?

Isn't this test needs to be updated or disabled?

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-22 Thread Pengcheng Wang via cfe-commits

wangpc-pp wrote:

> > Based on my rough understanding, this is expected?
> 
> What do you mean?
> 
> Isn't this test needs to be updated or disabled?

I think this ASAN failure is not caused by this PR because these memorys are 
allocated/deallocated by `memory_resource` directly, **there is nothing about 
`new`/`delete`**. We allocate 50 bytes via `void* ret = r1.allocate(50);` and 
deallocate 1 byte via `r1.deallocate(ret, 1);` and that's the reason why ASAN 
failed, because the size of the allocated type (50 bytes) and the size of the 
deallocated type (1 byte) are really not matched.

I don't know if this is what we want to test, if so, we may add `// 
UNSUPPORTED: asan` to skip this test in ASAN builds.
cc @ldionne @Quuxplusone

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-23 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> > > Based on my rough understanding, this is expected?
> > 
> > 
> > What do you mean?
> > Isn't this test needs to be updated or disabled?
> 
> I think this ASAN failure is not caused by this PR because these memorys are 
> allocated/deallocated by

100% sure by this PR
https://lab.llvm.org/buildbot/#/builders/168/builds/20461 only two patches on 
the blame list and the second one is unrelated for sure.

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-23 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

Internally ::allocate uses sided new:

```
 void*
allocate(size_t __bytes, size_t __alignment = _S_max_align)
__attribute__((__returns_nonnull__,__alloc_size__(2),__alloc_align__(3)))
{ return ::operator new(__bytes, do_allocate(__bytes, __alignment)); }

```

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-23 Thread Pengcheng Wang via cfe-commits

wangpc-pp wrote:

Thanks @vitalybuka! After some investigations, I think this PR just uncovered 
the existed ASAN problem.
```cpp
#if !defined(__cpp_sized_deallocation) || __cpp_sized_deallocation < 201309L
#  define _LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION
#endif

#if !defined(_LIBCPP_BUILDING_LIBRARY) && _LIBCPP_STD_VER < 14 && 
defined(_LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION)
#  define _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
#endif

#if defined(_LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION) || 
defined(_LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION)
#  define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
#endif

template 
_LIBCPP_HIDE_FROM_ABI void __do_deallocate_handle_size(void* __ptr, size_t 
__size, _Args... __args) {
#ifdef _LIBCPP_HAS_NO_SIZED_DEALLOCATION
  (void)__size;
  return std::__libcpp_operator_delete(__ptr, __args...);
#else
  return std::__libcpp_operator_delete(__ptr, __size, __args...);
#endif
}
```
The `__do_deallocate_handle_size` ignored the `__size` before this PR.

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-23 Thread Pengcheng Wang via cfe-commits

wangpc-pp wrote:

Thanks @vitalybuka for fixing the remain issues.
It has been about 2 days since this PR was merged and there is no other issue, 
I think we finally make sized deallocation default this time! Cheers!

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-06-13 Thread Nico Weber via cfe-commits

nico wrote:

This causes #95451.

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-06-04 Thread Mike Hommey via cfe-commits

glandium wrote:

This broke building clang on Windows with PGO:
```
FAILED: bin/clang-repl.exe lib/clang-repl.lib 
cmd.exe /C "cmd.exe /C "D:\task_171745452431588\fetches\cmake\bin\cmake.exe -E 
__create_def 
D:\task_171745452431588\fetches\llvm-project\build\stage2\build\tools\clang\tools\clang-repl\CMakeFiles\clang-repl.dir\.\exports.def
 
D:\task_171745452431588\fetches\llvm-project\build\stage2\build\tools\clang\tools\clang-repl\CMakeFiles\clang-repl.dir\.\exports.def.objs
 --nm=D:\task_171745452431588\fetches\clang\bin\llvm-nm.exe && cd 
D:\task_171745452431588\fetches\llvm-project\build\stage2\build" && 
D:\task_171745452431588\fetches\cmake\bin\cmake.exe -E vs_link_exe 
--intdir=tools\clang\tools\clang-repl\CMakeFiles\clang-repl.dir 
--rc="D:\task_171745452431588\fetches\vs\Windows 
Kits\10\bin\10.0.22621.0\x64\rc.exe" 
--mt="D:\task_171745452431588\fetches\vs\Windows 
Kits\10\bin\10.0.22621.0\x64\mt.exe" --manifests  -- 
D:\task_171745452431588\fetches\clang\bin\lld-link.exe /nologo 
@CMakeFiles\clang-repl.rsp  /out:bin\clang-repl.exe /implib:lib\clang-repl.lib 
/pdb:bin\clang-repl.pdb /version:0.0 /machine:x64 /STACK:1000 
/libpath:"D:/task_171745452431588/fetches/clang/lib/clang/19/lib/windows" 
/INCREMENTAL:NO /subsystem:console   /EXPORT:??_7type_info@@6B@ 
/EXPORT:?__type_info_root_node@@3U__type_info_node@@A 
/EXPORT:?nothrow@std@@3Unothrow_t@1@B /EXPORT:_Init_thread_abort 
/EXPORT:_Init_thread_epoch /EXPORT:_Init_thread_footer 
/EXPORT:_Init_thread_header /EXPORT:_tls_index /EXPORT:??2@YAPEAX_K@Z 
/EXPORT:??3@YAXPEAX@Z /EXPORT:??_U@YAPEAX_K@Z /EXPORT:??_V@YAXPEAX@Z 
/EXPORT:??3@YAXPEAX_K@Z 
/DEF:"D:/task_171745452431588/fetches/llvm-project/build/stage2/build/tools/clang/tools/clang-repl/clang-repl.def"
  -Wl,--long-plt 
/DEF:tools\clang\tools\clang-repl\CMakeFiles\clang-repl.dir\.\exports.def  && 
cd ."
LINK: command "D:\task_171745452431588\fetches\clang\bin\lld-link.exe /nologo 
@CMakeFiles\clang-repl.rsp /out:bin\clang-repl.exe /implib:lib\clang-repl.lib 
/pdb:bin\clang-repl.pdb /version:0.0 /machine:x64 /STACK:1000 
/libpath:D:/task_171745452431588/fetches/clang/lib/clang/19/lib/windows 
/INCREMENTAL:NO /subsystem:console /EXPORT:??_7type_info@@6B@ 
/EXPORT:?__type_info_root_node@@3U__type_info_node@@A 
/EXPORT:?nothrow@std@@3Unothrow_t@1@B /EXPORT:_Init_thread_abort 
/EXPORT:_Init_thread_epoch /EXPORT:_Init_thread_footer 
/EXPORT:_Init_thread_header /EXPORT:_tls_index /EXPORT:??2@YAPEAX_K@Z 
/EXPORT:??3@YAXPEAX@Z /EXPORT:??_U@YAPEAX_K@Z /EXPORT:??_V@YAXPEAX@Z 
/EXPORT:??3@YAXPEAX_K@Z 
/DEF:D:/task_171745452431588/fetches/llvm-project/build/stage2/build/tools/clang/tools/clang-repl/clang-repl.def
 -Wl,--long-plt 
/DEF:tools\clang\tools\clang-repl\CMakeFiles\clang-repl.dir\.\exports.def 
/MANIFEST /MANIFESTFILE:bin\clang-repl.exe.manifest" failed (exit code 1) with 
the following output:
lld-link: error: : undefined symbol: __profc_??$?0$$BY03DUdesc
lld-link: error: : undefined symbol: __profc_??$?0$$BY04DW4OptionHidden
lld-link: error: : undefined symbol: __profc_??$?0$$BY09DW4OptionHidden
lld-link: error: : undefined symbol: __profc_??$?0$$BY0BC
lld-link: error: : undefined symbol: __profc_??$?0$$BY0N
lld-link: error: : undefined symbol: __profc_??$?0W4FormattingFlags
lld-link: error: : undefined symbol: __profc_??$?4$$BY05D
lld-link: error: : undefined symbol: __profc_??$?6PEBD
lld-link: error: : undefined symbol: __profc_??$_Emplace_reallocate
lld-link: error: : undefined symbol: __profc_??$_Reallocate_for
lld-link: error: : undefined symbol: __profc_??$_Reallocate_grow_by
lld-link: error: : undefined symbol: __profc_??$_Traits_find 
lld-link: error: : undefined symbol: __profc_??$_Traits_rfind
lld-link: error: : undefined symbol: __profc_??$_Uninitialized_move
lld-link: error: : undefined symbol: __profc_??$addValue
lld-link: error: : undefined symbol: __profc_??$handleErrors 
lld-link: error: : undefined symbol: __profc_??$setValue
lld-link: error: : undefined symbol: __profc_??0?$OptionValueCopy
lld-link: error: : undefined symbol: __profc_??0Completion
lld-link: error: : undefined symbol: __profc_??0ErrorList
lld-link: error: too many errors emitted, stopping now (use /errorlimit:0 to 
see all errors)
```

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-06-04 Thread Pengcheng Wang via cfe-commits

wangpc-pp wrote:

> This broke building clang on Windows with PGO:
> 
> ```
> FAILED: bin/clang-repl.exe lib/clang-repl.lib 
> cmd.exe /C "cmd.exe /C "D:\task_171745452431588\fetches\cmake\bin\cmake.exe 
> -E __create_def 
> D:\task_171745452431588\fetches\llvm-project\build\stage2\build\tools\clang\tools\clang-repl\CMakeFiles\clang-repl.dir\.\exports.def
>  
> D:\task_171745452431588\fetches\llvm-project\build\stage2\build\tools\clang\tools\clang-repl\CMakeFiles\clang-repl.dir\.\exports.def.objs
>  --nm=D:\task_171745452431588\fetches\clang\bin\llvm-nm.exe && cd 
> D:\task_171745452431588\fetches\llvm-project\build\stage2\build" && 
> D:\task_171745452431588\fetches\cmake\bin\cmake.exe -E vs_link_exe 
> --intdir=tools\clang\tools\clang-repl\CMakeFiles\clang-repl.dir 
> --rc="D:\task_171745452431588\fetches\vs\Windows 
> Kits\10\bin\10.0.22621.0\x64\rc.exe" 
> --mt="D:\task_171745452431588\fetches\vs\Windows 
> Kits\10\bin\10.0.22621.0\x64\mt.exe" --manifests  -- 
> D:\task_171745452431588\fetches\clang\bin\lld-link.exe /nologo 
> @CMakeFiles\clang-repl.rsp  /out:bin\clang-repl.exe 
> /implib:lib\clang-repl.lib /pdb:bin\clang-repl.pdb /version:0.0 /machine:x64 
> /STACK:1000 
> /libpath:"D:/task_171745452431588/fetches/clang/lib/clang/19/lib/windows" 
> /INCREMENTAL:NO /subsystem:console   /EXPORT:??_7type_info@@6B@ 
> /EXPORT:?__type_info_root_node@@3U__type_info_node@@A 
> /EXPORT:?nothrow@std@@3Unothrow_t@1@B /EXPORT:_Init_thread_abort 
> /EXPORT:_Init_thread_epoch /EXPORT:_Init_thread_footer 
> /EXPORT:_Init_thread_header /EXPORT:_tls_index /EXPORT:??2@YAPEAX_K@Z 
> /EXPORT:??3@YAXPEAX@Z /EXPORT:??_U@YAPEAX_K@Z /EXPORT:??_V@YAXPEAX@Z 
> /EXPORT:??3@YAXPEAX_K@Z 
> /DEF:"D:/task_171745452431588/fetches/llvm-project/build/stage2/build/tools/clang/tools/clang-repl/clang-repl.def"
>   -Wl,--long-plt 
> /DEF:tools\clang\tools\clang-repl\CMakeFiles\clang-repl.dir\.\exports.def  && 
> cd ."
> LINK: command "D:\task_171745452431588\fetches\clang\bin\lld-link.exe /nologo 
> @CMakeFiles\clang-repl.rsp /out:bin\clang-repl.exe /implib:lib\clang-repl.lib 
> /pdb:bin\clang-repl.pdb /version:0.0 /machine:x64 /STACK:1000 
> /libpath:D:/task_171745452431588/fetches/clang/lib/clang/19/lib/windows 
> /INCREMENTAL:NO /subsystem:console /EXPORT:??_7type_info@@6B@ 
> /EXPORT:?__type_info_root_node@@3U__type_info_node@@A 
> /EXPORT:?nothrow@std@@3Unothrow_t@1@B /EXPORT:_Init_thread_abort 
> /EXPORT:_Init_thread_epoch /EXPORT:_Init_thread_footer 
> /EXPORT:_Init_thread_header /EXPORT:_tls_index /EXPORT:??2@YAPEAX_K@Z 
> /EXPORT:??3@YAXPEAX@Z /EXPORT:??_U@YAPEAX_K@Z /EXPORT:??_V@YAXPEAX@Z 
> /EXPORT:??3@YAXPEAX_K@Z 
> /DEF:D:/task_171745452431588/fetches/llvm-project/build/stage2/build/tools/clang/tools/clang-repl/clang-repl.def
>  -Wl,--long-plt 
> /DEF:tools\clang\tools\clang-repl\CMakeFiles\clang-repl.dir\.\exports.def 
> /MANIFEST /MANIFESTFILE:bin\clang-repl.exe.manifest" failed (exit code 1) 
> with the following output:
> lld-link: error: : undefined symbol: __profc_??$?0$$BY03DUdesc
> lld-link: error: : undefined symbol: __profc_??$?0$$BY04DW4OptionHidden
> lld-link: error: : undefined symbol: __profc_??$?0$$BY09DW4OptionHidden
> lld-link: error: : undefined symbol: __profc_??$?0$$BY0BC
> lld-link: error: : undefined symbol: __profc_??$?0$$BY0N
> lld-link: error: : undefined symbol: __profc_??$?0W4FormattingFlags
> lld-link: error: : undefined symbol: __profc_??$?4$$BY05D
> lld-link: error: : undefined symbol: __profc_??$?6PEBD
> lld-link: error: : undefined symbol: __profc_??$_Emplace_reallocate
> lld-link: error: : undefined symbol: __profc_??$_Reallocate_for
> lld-link: error: : undefined symbol: __profc_??$_Reallocate_grow_by
> lld-link: error: : undefined symbol: __profc_??$_Traits_find 
> lld-link: error: : undefined symbol: __profc_??$_Traits_rfind
> lld-link: error: : undefined symbol: __profc_??$_Uninitialized_move
> lld-link: error: : undefined symbol: __profc_??$addValue
> lld-link: error: : undefined symbol: __profc_??$handleErrors 
> lld-link: error: : undefined symbol: __profc_??$setValue
> lld-link: error: : undefined symbol: __profc_??0?$OptionValueCopy
> lld-link: error: : undefined symbol: __profc_??0Completion
> lld-link: error: : undefined symbol: __profc_??0ErrorList
> lld-link: error: too many errors emitted, stopping now (use /errorlimit:0 to 
> see all errors)
> ```

I don't have such environment, can you provide more details? And it seems these 
undefined symbols are not symbols for `delete`.

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-06-04 Thread Mike Hommey via cfe-commits

glandium wrote:

What kind of detail are you looking for?

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-06-05 Thread Pengcheng Wang via cfe-commits

wangpc-pp wrote:

> What kind of detail are you looking for?

Mainly about the commands of cmake building. Does this failure bind to a 
buildbot?
And can @AaronBallman @vitalybuka @vgvassilev help me to figure this out?

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-06-05 Thread Vassil Vassilev via cfe-commits

vgvassilev wrote:

It seems we have troubles with exporting the right symbols on windows. I am 
cc-ing @compnerd and @fsfod for more expertise.

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-06-05 Thread Mike Hommey via cfe-commits

glandium wrote:

> Mainly about the commands of cmake building.

However you build clang on windows using clang, with the addition of 
-DLLVM_BUILD_INSTRUMENTED=IR -DLLVM_BUILD_RUNTIME=No

> Does this failure bind to a buildbot?

I have no idea, but probably not, otherwise you'd have heard from it already.

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-06-05 Thread Mike Hommey via cfe-commits

glandium wrote:

There is something wrong going on with cmake:
STR:
- Download 
[testcase.zip](https://github.com/user-attachments/files/15597940/testcase.zip)
- Unzip it (it contains ClangRepl.cpp.obj and exports.def.objs)
- Run `cmake -E __create_def exports.def exports.def.objs --nm=/path/to/llvm-nm`

When running this with cmake on Windows, taking one of the symbols the lld-link 
was saying were missing:
```
__profc_??$_Emplace_reallocate   DATA
__profd_??$_Emplace_reallocate   DATA
__profvp_??$_Emplace_reallocate  DATA

??$_Emplace_reallocate@AEBI@?$vector@IV?$allocator@I@std@@@std@@AEAAPEAIQEAIAEBI@Z

??$_Emplace_reallocate@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@AEAAPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@QEAV21@AEBV21@@Z

??$_Emplace_reallocate@U?$OptionValue@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cl@llvm@@@?$vector@U?$OptionValue@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cl@llvm@@V?$allocator@U?$OptionValue@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cl@llvm@@@std@@@std@@AEAAPEAU?$OptionValue@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cl@llvm@@QEAU234@$$QEAU234@@Z

??$_Emplace_reallocate@UCompletion@LineEditor@llvm@@@?$vector@UCompletion@LineEditor@llvm@@V?$allocator@UCompletion@LineEditor@llvm@@@std@@@std@@AEAAPEAUCompletion@LineEditor@llvm@@QEAU234@$$QEAU234@@Z

??$_Emplace_reallocate@V?$unique_ptr@VErrorInfoBase@llvm@@U?$default_delete@VErrorInfoBase@llvm@@@std@@@std@@@?$vector@V?$unique_ptr@VErrorInfoBase@llvm@@U?$default_delete@VErrorInfoBase@llvm@@@std@@@std@@V?$allocator@V?$unique_ptr@VErrorInfoBase@llvm@@U?$default_delete@VErrorInfoBase@llvm@@@std@@@std@@@2@@std@@AEAAPEAV?$unique_ptr@VErrorInfoBase@llvm@@U?$default_delete@VErrorInfoBase@llvm@@@std@@@1@QEAV21@$$QEAV21@@Z
```
Doing the same on Linux:
```

__profc_??$_Emplace_reallocate@AEBI@?$vector@IV?$allocator@I@std@@@std@@AEAAPEAIQEAIAEBI@Z.140565309351188016
DATA

__profc_??$_Emplace_reallocate@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@AEAAPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@QEAV21@AEBV21@@Z.166520529307557042
DATA

__profc_??$_Emplace_reallocate@U?$OptionValue@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cl@llvm@@@?$vector@U?$OptionValue@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cl@llvm@@V?$allocator@U?$OptionValue@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cl@llvm@@@std@@@std@@AEAAPEAU?$OptionValue@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cl@llvm@@QEAU234@$$QEAU234@@Z.940266886021390796
 DATA

__profc_??$_Emplace_reallocate@UCompletion@LineEditor@llvm@@@?$vector@UCompletion@LineEditor@llvm@@V?$allocator@UCompletion@LineEditor@llvm@@@std@@@std@@AEAAPEAUCompletion@LineEditor@llvm@@QEAU234@$$QEAU234@@Z.928018419188693000
 DATA

__profc_??$_Emplace_reallocate@V?$unique_ptr@VErrorInfoBase@llvm@@U?$default_delete@VErrorInfoBase@llvm@@@std@@@std@@@?$vector@V?$unique_ptr@VErrorInfoBase@llvm@@U?$default_delete@VErrorInfoBase@llvm@@@std@@@std@@V?$allocator@V?$unique_ptr@VErrorInfoBase@llvm@@U?$default_delete@VErrorInfoBase@llvm@@@std@@@std@@@2@@std@@AEAAPEAV?$unique_ptr@VErrorInfoBase@llvm@@U?$default_delete@VErrorInfoBase@llvm@@@std@@@1@QEAV21@$$QEAV21@@Z.1073799611620789089
DATA

__profd_??$_Emplace_reallocate@AEBI@?$vector@IV?$allocator@I@std@@@std@@AEAAPEAIQEAIAEBI@Z.140565309351188016
DATA

__profd_??$_Emplace_reallocate@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@AEAAPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@QEAV21@AEBV21@@Z.166520529307557042
DATA

__profd_??$_Emplace_reallocate@U?$OptionValue@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cl@llvm@@@?$vector@U?$OptionValue@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cl@llvm@@V?$allocator@U?$OptionValue@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cl@llvm@@@std@@@std@@AEAAPEAU?$OptionValue@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cl@llvm@@QEAU234@$$QEAU234@@Z.940266886021390796
 DATA

__profd_??$_Emplace_reallocate@UCompletion@LineEditor@llvm@@@?$vector@UCompletion@LineEditor@llvm@@V?$allocator@UCompletion@LineEditor@llvm@@@std@@@std@@AEAAPEAUCompletion@LineEditor@llvm@@QEAU

[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-06-05 Thread Mike Hommey via cfe-commits

glandium wrote:

Filed https://gitlab.kitware.com/cmake/cmake/-/issues/26031

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-06-05 Thread Pengcheng Wang via cfe-commits

wangpc-pp wrote:

> Filed https://gitlab.kitware.com/cmake/cmake/-/issues/26031

So this is a cmake bug, not clang's, right?


https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-06-05 Thread Mike Hommey via cfe-commits

glandium wrote:

Yes

https://github.com/llvm/llvm-project/pull/90373
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits