[all-commits] [llvm/llvm-project] f16941: [clang] Simplify the overload resolution logic for...
Oliver Hunt via All-commits
all-commits at lists.llvm.org
Sat Aug 8 15:44:22 PDT 2026
Branch: refs/heads/users/ojhunt/simplify-operator-new-overload-resolution
Home: https://github.com/llvm/llvm-project
Commit: f16941b1d0b21c665d23ffce3c8da64e919df99d
https://github.com/llvm/llvm-project/commit/f16941b1d0b21c665d23ffce3c8da64e919df99d
Author: Oliver Hunt <oliver at apple.com>
Date: 2026-08-08 (Sat, 08 Aug 2026)
Changed paths:
M clang/include/clang/Basic/DiagnosticSemaKinds.td
A clang/include/clang/Sema/DynamicAllocationArgumentsCXX.h
M clang/include/clang/Sema/Sema.h
M clang/lib/Sema/SemaCoroutine.cpp
M clang/lib/Sema/SemaExprCXX.cpp
A clang/test/SemaCXX/microsoft-new-array-fallback.cpp
A clang/test/SemaCXX/type-aware-new-invalid-alignvalt-cache.cpp
M clang/test/SemaCXX/type-aware-new-invalid-type-identity.cpp
Log Message:
-----------
[clang] Simplify the overload resolution logic for operator new and new[]
This PR replaces the current spec-equivalent argument list mutation with
direct iteration of the correctly ordered set of argument lists for a
given allocation.
This adds a bit of architectural work around the argument list construction
but the overall effect is substantially simplified search of the overload
candidates.
* We now simply enumerate correctly ordered candidates for the implicit
arguments. This means no more re-entrant modification of the argument
list to handle addition and removal of type-identity or alignment
parameters.
* We no longer mutate the primary LookupResult when attempting the MSVC
array fallback. This also lays the groundwork for correct diagnostics
of such cases. For now we have a minor improvement of correctly
reporting the operator we were trying to resolve originally, and tell
the user that we have attempted the MSVC fallback if applicable.
LLM usage:
Depressingly claude actually did something right:
- Identified align_val_t being cached alongside size_t was likely
unsound, which was easy enough to create a test for.
- It also noted that tryBuildStdTypeIdentity could be reentrant,
and was able to construct a test case when I could not. That is
now test #5 in type-aware-new-invalid-type-identity.cpp.
An invalid type_identity defined as:
```cpp
template <class T> struct type_identity {
using type = decltype(new T);
};
```
triggers re-entrant evaluation of getTypeIdentityArgument
invalidating the insertion slot.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list