[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -17389,6 +17389,19 @@ Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, Previous.clear(); } + // I think DC check should be DC->isStdNamespace()? + // Also these guards are questionable - it's possible to get incorrect + // codegen w

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -0,0 +1,73 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++2c -fcxx-type-aware-allocators -fexceptions + +namespace std { + template struct type_identity {}; + enum class align_val_t : __SIZE_TYPE__ {}; + struct destroying_delete_t { explicit destroying_delete_t()

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -17389,6 +17389,19 @@ Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, Previous.clear(); } + // I think DC check should be DC->isStdNamespace()? erichkeane wrote: Should it? https://github.com/llvm/llvm-project/pull

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -0,0 +1,95 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 -fcxx-type-aware-allocators +// RUN: %clang_cc1 -fsyntax-only -verify %s -DNO_TAA -std=c++17 -fno-cxx-type-aware-allocators + +namespace std { + template struct type_identity {}; + enum class al

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -0,0 +1,302 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s-std=c++2c -fcxx-type-aware-allocators -fexceptions +// RUN: %clang_cc1 -fsyntax-only -verify %s -DTADD -std=c++2c -fcxx-type-aware-allocators -fcxx-type-aware-destroying-delete -fexceptions + +namespace std {

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -2474,19 +2474,46 @@ bool CXXMethodDecl::isUsualDeallocationFunction( getOverloadedOperator() != OO_Array_Delete) return false; + auto NumParams = getNumParams(); + bool IsTypeAware = IsTypeAwareOperatorNewOrDelete(); + // C++ [basic.stc.dynamic.deallocation]

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -2474,19 +2474,46 @@ bool CXXMethodDecl::isUsualDeallocationFunction( getOverloadedOperator() != OO_Array_Delete) return false; + auto NumParams = getNumParams(); + bool IsTypeAware = IsTypeAwareOperatorNewOrDelete(); + // C++ [basic.stc.dynamic.deallocation]

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -2474,19 +2474,46 @@ bool CXXMethodDecl::isUsualDeallocationFunction( getOverloadedOperator() != OO_Array_Delete) return false; + auto NumParams = getNumParams(); + bool IsTypeAware = IsTypeAwareOperatorNewOrDelete(); + // C++ [basic.stc.dynamic.deallocation]

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -3358,6 +3358,12 @@ bool FunctionDecl::isReservedGlobalPlacementOperator() const { return false; const auto *proto = getType()->castAs(); + if (proto->getNumParams() < 2) +return false; + bool IsTypeAwareAllocator = erichkeane wrote: is this b

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -8126,7 +8143,7 @@ class Sema final : public SemaBase { /// The scope in which to find allocation functions. enum AllocationFunctionScope { -/// Only look for allocation functions in the global scope. +/// Only look for allocation functions in the global scope -

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I cant find my comment, but I see the args structure isn't actually stored anywhere except as params, so feel free to disregard that comment. https://github.com/llvm/llvm-project/pull/113510 ___ cfe-commits mai

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -4749,6 +4753,15 @@ class Sema final : public SemaBase { CXXRecordDecl *getStdBadAlloc() const; EnumDecl *getStdAlignValT() const; + ClassTemplateDecl *getStdTypeIdentity() const; + std::optional InstantiateSpecializedTypeIdentity(QualType Subject); e

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -2474,19 +2474,46 @@ bool CXXMethodDecl::isUsualDeallocationFunction( getOverloadedOperator() != OO_Array_Delete) return false; + auto NumParams = getNumParams(); + bool IsTypeAware = IsTypeAwareOperatorNewOrDelete(); + // C++ [basic.stc.dynamic.deallocation]

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -2474,19 +2474,46 @@ bool CXXMethodDecl::isUsualDeallocationFunction( getOverloadedOperator() != OO_Array_Delete) return false; + auto NumParams = getNumParams(); erichkeane wrote: Don't use auto here, only when the type is on the RHS per coding

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -2234,6 +2234,17 @@ enum class CXXNewInitializationStyle { Braces }; +struct ImplicitAllocationParameters { + bool PassTypeIdentity; erichkeane wrote: minor preference for all of these being bitfields, or perhaps make this an `enum` type that we can us

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/113510 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Initial implementation of P2719 (PR #113510)

2024-10-25 Thread Erich Keane via cfe-commits
@@ -307,6 +307,10 @@ EXTENSION(datasizeof, LangOpts.CPlusPlus) FEATURE(cxx_abi_relative_vtable, LangOpts.CPlusPlus && LangOpts.RelativeCXXABIVTables) +// Type aware allocators +FEATURE(cxx_type_aware_allocators, LangOpts.TypeAwareAllocators) erichkeane wrote

[clang] Initial implementation of P2719 (PR #113510)

2024-10-24 Thread Chuanqi Xu via cfe-commits
@@ -1,6 +1,9 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -O2 \ // RUN:-Wno-coroutine-missing-unhandled-exception -emit-llvm %s -o - -disable-llvm-passes \ // RUN: | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -O2 \ +

[clang] Initial implementation of P2719 (PR #113510)

2024-10-24 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-static-analyzer-1 @llvm/pr-subscribers-clang-modules Author: Oliver Hunt (ojhunt) Changes This is a basic implementation of P2719: "Type-aware allocation and deallocation functions" described at http://wg21.link/P2719 The proposal includes some m

[clang] Initial implementation of P2719 (PR #113510)

2024-10-24 Thread via cfe-commits
https://github.com/cor3ntin ready_for_review https://github.com/llvm/llvm-project/pull/113510 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Initial implementation of P2719 (PR #113510)

2024-10-24 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @cor3ntin oh yeah, I know, I'm also there :D https://github.com/llvm/llvm-project/pull/113510 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Initial implementation of P2719 (PR #113510)

2024-10-24 Thread via cfe-commits
cor3ntin wrote: Thanks for working on this. FYI most reviewers at the LLVM conference, do not expect a lot of feedback this week We will need to call consensus on https://discourse.llvm.org/t/rfc-typed-allocator-support/79720 first in any case https://github.com/llvm/llvm-project/pull/113510

[clang] Initial implementation of P2719 (PR #113510)

2024-10-23 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 2deb3a26fa47a4640962489e5473726d7a8bf12b 2da55a9d9db62e80cddd83f86e26d31537e571b5 --e