[clang] [clang] Simplify the overload resolution logic for operator new and new[] (PR #211482)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 28 18:00:17 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- clang/include/clang/Sema/DynamicAllocationArgumentsCXX.h clang/test/SemaCXX/microsoft-new-array-fallback.cpp clang/test/SemaCXX/type-aware-new-invalid-alignvalt-cache.cpp clang/include/clang/Sema/Sema.h clang/lib/Sema/SemaCoroutine.cpp clang/lib/Sema/SemaExprCXX.cpp clang/test/SemaCXX/type-aware-new-invalid-type-identity.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index f15dca03b..7aa9b31ee 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -2946,7 +2946,8 @@ DiagnoseAllocationLookupFailure(Sema &SemaRef, const LookupResult &R,
 
 std::optional<Expr *> Sema::getTypeIdentityArgument(QualType Type,
                                                     SourceLocation Loc) {
-  if (auto Found = AllocationTypeIdentityArguments.find(Type); Found != AllocationTypeIdentityArguments.end())
+  if (auto Found = AllocationTypeIdentityArguments.find(Type);
+      Found != AllocationTypeIdentityArguments.end())
     return Found->second;
 
   QualType TypeIdentity = tryBuildStdTypeIdentity(Type, Loc);

``````````

</details>


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


More information about the cfe-commits mailing list