8 Commits

Author SHA1 Message Date
Timm Baeder
59e899e16b
[clang][bytecode] Don't unref constexpr-unknown references (#190177)
If the pointer for a reference is constexpr-unknown, use the pointer
itself instead, instead of dereferencing it. Unfortunately, that means
constexpr-unknown pointers to reach a lot more places than before.
2026-04-06 15:52:17 +02:00
Timm Baeder
8edbf23098
[clang][bytecode] Revisit reference variables as constexpr-unknown in C++26 (#187918)
When revisiting `const T& range = f(T());`, we do mark the variable for
`range` as constexpr-unknown, but not the temporary variable we create
for `T()`. Change that.

Then we also need to ignore constexpr-unknown pointers in
`CheckInvoke()`.

Fixes https://github.com/llvm/llvm-project/issues/187775
2026-04-01 09:49:55 +02:00
Timm Baeder
f748c718a8
[clang][bytecode] Don't use throw as invalid in c++26 (#181150)
Don't pass a combination of `-std=c++26` and `-fcxx-exceptions` to tests
and then try to use `throw` as an invalid statement. C++26 actually has
working exceptions at compile time, even if that is currently not
implemented.
2026-02-12 15:52:23 +01:00
Timm Baeder
9ec0eccf48
[clang][bytecode] Fix a crash with explicit this parameters (#177154)
Fixes https://github.com/llvm/llvm-project/issues/177133
2026-01-22 12:42:28 +01:00
keinflue
2d45a91095
[clang][bytecode] Fix void*-to-ptr casts originating from new/new[] (#174132)
In void*-to-ptr casts, the type of the pointed-to object in the source
operand needs to be compared to the target pointee type.

If a block was created for a `new`/`new[]`/`std::allocator` expression,
then a pointer needs to be stripped from the type of the expression
(which points to the single-object allocation or first element of the
allocation) to get the former.

`Descriptor::getType` did not do this and `Descriptor::getDataType`
returns an array type for array allocations. Therefore this introduces a
new function `Descriptor::getDataElemType` with the same behavior as
`Descriptor::getDataType`, except that it always produces the element
type in the array case and avoids the need for an `ASTContext`
reference. Make `Pointer::getType` use this function instead.

Fixes #174131
2026-01-02 19:07:19 +01:00
Timm Baeder
1a78ef9a9e
[clang][bytecode] Allow casts from void* only in std::allocator calls (#136714)
Otherwise, add the missing diagnostic.
2025-04-23 08:00:57 +02:00
Timm Baeder
9387fd9631
[clang][bytecode] Fix diagnosing replaceable global allocator functions (#126717)
Don't return true here in InvalidNewDeleteExpr just because we are in
C++26 mode. This invalid there as well.

Testcase reduced from
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique_for_overwrite.pass.cpp
2025-02-11 16:51:21 +01: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