Timm Baeder
96336acb48
[clang][bytecode] Tighten double-destroy check ( #129528 )
...
The instance pointer of the current function being the same as the one
we're destroying is only relevant if said function is also a destructor.
2025-03-03 16:26:56 +01:00
Timm Baeder
c38befd94f
[clang][bytecode] Fix delete[] dtor order ( #128411 )
...
As always, call array dtors in reverse order.
2025-02-23 11:32:35 +01:00
Timm Baeder
43e83b9405
[clang][bytecode] Fix allocating primitive arrays of unknown bound ( #127788 )
2025-02-19 14:29:52 +01:00
Timm Baeder
09d14149f6
[clang][bytecode] Fix return value of array CXXNewExprs ( #127526 )
...
Just like with the __builtin_operator_new version, we need to point to
the first array element, not the array element itself.
2025-02-18 02:41:25 +01:00
Timm Baeder
36f8c8b438
[clang][bytecode] Fix rejecting non-constexpr array ctors ( #127448 )
...
We shouldn't abort here when compiling, this is happening (and properly
diagnosed) when interpreting the bytecode.
2025-02-17 08:06:12 +01:00
Timm Baeder
20506a0a15
[clang][bytecode] Fix operator new source expression ( #126870 )
...
... for composite element types. Looks like I forgot this in
e6030d389571b3f1b0f0c5a35b7fa45937ed0f6c
2025-02-12 10:05:49 +01:00
Timm Baeder
199c791a1d
[clang][bytecode] Support partial initializers for CXXNewExprs ( #126494 )
...
For `new A[N]{1,2,3}`, we need to allocate N elements of type A, and
initialize the first three with the given InitListExpr elements.
However, if N is larger than 3, we need to initialize the remaining
elements with the InitListExpr array filler.
Similarly, for `new A[N];`, we need to initilize all fields with the
constructor of A. The initializer type is a CXXConstructExpr of
IncompleteArrayType in this case, which we can't generally handle.
2025-02-10 14:28:40 +01:00
Timm Baeder
e6030d3895
[clang][bytecode] Use std::allocator calls for Descriptor source ( #123900 )
...
... for the dynamic blocks created for operator new calls. This way we
get the type of memory allocated right. As a side-effect, the
diagnostics now point to the std::allocator calls, which is an
improvement.
2025-01-24 11:50:56 +01:00
Timm Baeder
886adf8fb3
[clang][ExprConst] Let diagnostics point to std::allocator calls ( #123744 )
...
Instead of the underlying operator new calls. This fixes a longstanding
FIXME comment in cxx2a-constexpr-dynalloc.cpp.
2025-01-24 08:40:49 +01:00
Timm Baeder
ccb7cc319f
[clang][bytecode] Diagnose negative array sizes differently ( #114380 )
...
We have a special diagnostic ID for this.
2024-10-31 10:59:53 +01:00
Timm Baeder
f0b9a0ba06
[clang][bytecode] Diagnose delete with non-virtual dtor ( #114373 )
...
... in the base class.
2024-10-31 10:13:40 +01:00
Timm Baeder
3eaf4a9d1a
[clang][bytecode] Check for memory leaks after destroying global scope ( #112868 )
...
The global scope we create when evaluating expressions might free some
of the dynamic memory allocations, so we can't check for memory leaks
before destroying it.
2024-10-18 13:03:13 +02:00
Timm Baeder
f93258e4ac
[clang][bytecode] Diagnose class-specific operator delete calls ( #111700 )
2024-10-10 08:40:14 +02:00
Timm Baeder
4b96400240
[clang][bytecode] Allow placement-new in std functions pre-C++26 ( #109753 )
2024-09-24 10:28:54 +02:00
Timm Baeder
c712ab829b
[clang][bytecode] Implement placement-new ( #107033 )
...
If we have a placement-new destination already, use that instead of
allocating a new one.
Tests are partially based on
`test/SemaCXX/cxx2c-constexpr-placement-new.cpp`.
2024-09-23 13:26:49 +02:00
Timm Baeder
898fd396b8
[clang][bytecode] Check allocation size limit for operator new ( #109590 )
2024-09-23 09:59:41 +02:00
Timm Baeder
9a32f28366
[clang][bytecode] Fix a problem with array size limits ( #109383 )
...
Descriptor::MaxArrayElemBytes is an unsigned value, which might overflow
the SizeT we have in CheckArraySize.
2024-09-20 11:26:58 +02:00
Timm Baeder
6f67c38684
[clang][bytecode] Fix a variable scope problem with continue/break jumps ( #107738 )
...
Cleaning up _all_ the scopes is a little too much. Only clean up until
the point here we started the scope relevant for the break/continue
statement.
2024-09-08 19:22:18 +02:00
Timm Baeder
78cf9b830c
[clang][bytecode] Implement using operator new/operator delete ( #107679 )
...
Reuse the __builtin_operator_{new,delete} implementations.
2024-09-07 12:17:54 +02:00
Timm Baeder
610b85395d
[clang][bytecode] Implement __builtin_operator{new,delete} ( #107672 )
2024-09-07 09:57:26 +02:00
Timm Baeder
df11ee213e
[clang][bytecode] Diagnose member calls on deleted blocks ( #106529 )
...
This requires a bit of restructuring of ctor calls when checking for a
potential constant expression.
2024-08-29 15:22:59 +02:00
cor3ntin
c821cc3f88
[Clang] Correctly finds subexpressions of immediate invocations ( #106055 )
...
We were not correctly ignoring implicit casts.
Fixes #105558
2024-08-26 22:55:32 +02:00
cor3ntin
6e78aef646
[Clang] Implement P2747 constexpr placement new ( #104586 )
...
The implementation follows the resolution of CWG2922
2024-08-23 17:24:08 +02:00
Timm Baeder
a07aba5d44
[clang] Rename all AST/Interp stuff to AST/ByteCode ( #104552 )
...
"Interp" clashes with the clang interpreter and people often confuse
this.
2024-08-16 17:13:12 +02:00