-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[clang] make it possible to disable c++26 type aware allocators #138372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Per the feedback from the Clang Area Team, this PR makes P2719 only on by default when targeting C++26, and adds a flag to explicitly enable or disable support.
@llvm/pr-subscribers-clang-codegen @llvm/pr-subscribers-clang-driver Author: Oliver Hunt (ojhunt) ChangesPer the feedback from the Clang Area Team, this PR makes P2719 only on by default when targeting C++26, and adds a flag to explicitly enable or disable support. Patch is 60.11 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/138372.diff 16 Files Affected:
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 4bd9d904e1ea9..53fb4e640a351 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -110,6 +110,8 @@ C++2c Feature Support
- Implemented `P0963R3 Structured binding declaration as a condition <https://wg21.link/P0963R3>`_.
- Implemented `P2719R4 Type-aware allocation and deallocation functions <https://wg21.link/P2719>`_.
+ This is enabled by default when targeting C++2c, and can be enabled or disabled by
+ the ``-fcxx-type-aware-allocators`` and ``-fno-cxx-type-aware-allocators`` options.
C++23 Feature Support
^^^^^^^^^^^^^^^^^^^^^
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index e5a7cdc14a737..eb28f0ce9c8fd 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -9956,6 +9956,9 @@ def warn_cxx26_type_aware_allocators : Warning<
def err_type_aware_allocator_missing_matching_operator : Error<
"declaration of type aware %0 in %1 must have matching type aware %2"
>;
+def err_type_aware_allocators_disabled
+ : Error<"type aware %0 declared but type aware allocator support is "
+ "disabled. Pass -fcxx-type-aware-allocators to enable it">;
def note_unmatched_type_aware_allocator_declared : Note<
"unmatched type aware %0 declared here">;
def err_mismatching_type_aware_cleanup_deallocator : Error<
diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def
index 930c1c06d1a76..7dc817119c9ac 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -314,6 +314,7 @@ LANGOPT(SizedDeallocation , 1, 0, "sized deallocation")
LANGOPT(AlignedAllocation , 1, 0, "aligned allocation")
LANGOPT(AlignedAllocationUnavailable, 1, 0, "aligned allocation functions are unavailable")
LANGOPT(NewAlignOverride , 32, 0, "maximum alignment guaranteed by '::operator new(size_t)'")
+LANGOPT(CXXTypeAwareAllocators, 1, 0, "type aware allocators")
BENIGN_LANGOPT(ModulesCodegen , 1, 0, "Modules code generation")
BENIGN_LANGOPT(ModulesDebugInfo , 1, 0, "Modules debug info")
BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision")
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 736088a70d189..cea63f2636152 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3539,6 +3539,12 @@ def : Separate<["-"], "fnew-alignment">, Alias<fnew_alignment_EQ>;
def : Flag<["-"], "faligned-new">, Alias<faligned_allocation>;
def : Flag<["-"], "fno-aligned-new">, Alias<fno_aligned_allocation>;
def faligned_new_EQ : Joined<["-"], "faligned-new=">;
+defm cxx_type_aware_allocators
+ : BoolFOption<"cxx-type-aware-allocators",
+ LangOpts<"CXXTypeAwareAllocators">, Default<cpp26.KeyPath>,
+ PosFlag<SetTrue, [], [],
+ "Enable support for C++26's type aware allocators">,
+ NegFlag<SetFalse>, BothFlags<[], [ClangOption, CC1Option]>>;
def fobjc_legacy_dispatch : Flag<["-"], "fobjc-legacy-dispatch">, Group<f_Group>;
def fobjc_new_property : Flag<["-"], "fobjc-new-property">, Group<clang_ignored_f_Group>;
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 3e8c42d5a6f4b..eaa513313e182 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -1487,6 +1487,7 @@ namespace {
TypeAwareAllocationMode TypeAwareDeallocation =
TypeAwareAllocationMode::No;
if (OperatorDelete->isTypeAwareOperatorNewOrDelete()) {
+ assert(CGF.getLangOpts().CXXTypeAwareAllocators);
TypeAwareDeallocation = TypeAwareAllocationMode::Yes;
QualType SpecializedTypeIdentity = FPT->getParamType(0);
++FirstNonTypeArg;
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 6dabf9d842b7b..d2788a0973ed4 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -7516,6 +7516,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Args.addLastArg(CmdArgs, options::OPT_fsized_deallocation,
options::OPT_fno_sized_deallocation);
+ // -fcxx-type-aware-allocators is on by default in C++26 onwards and otherwise
+ // off by default.
+ Args.addLastArg(CmdArgs, options::OPT_fcxx_type_aware_allocators,
+ options::OPT_fno_cxx_type_aware_allocators);
+
// -faligned-allocation is on by default in C++17 onwards and otherwise off
// by default.
if (Arg *A = Args.getLastArg(options::OPT_faligned_allocation,
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 1f297f228fc1b..6d95c7d0e4c4e 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -778,7 +778,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
Builder.defineMacro("__cpp_impl_destroying_delete", "201806L");
// TODO: Final number?
- Builder.defineMacro("__cpp_type_aware_allocators", "202500L");
+ if (LangOpts.CXXTypeAwareAllocators)
+ Builder.defineMacro("__cpp_type_aware_allocators", "202500L");
}
/// InitializeOpenCLFeatureTestMacros - Define OpenCL macros based on target
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 22e21524c54be..a574508e18a05 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -7326,47 +7326,50 @@ void Sema::CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record) {
checkCUDADeviceBuiltinTextureClassTemplate(*this, Record);
}
- llvm::SmallDenseMap<OverloadedOperatorKind,
- llvm::SmallVector<const FunctionDecl *, 2>, 4>
- TypeAwareDecls{{OO_New, {}},
- {OO_Array_New, {}},
- {OO_Delete, {}},
- {OO_Array_New, {}}};
- for (auto *D : Record->decls()) {
- const FunctionDecl *FnDecl = D->getAsFunction();
- if (!FnDecl || !FnDecl->isTypeAwareOperatorNewOrDelete())
- continue;
- assert(FnDecl->getDeclName().isAnyOperatorNewOrDelete());
- TypeAwareDecls[FnDecl->getOverloadedOperator()].push_back(FnDecl);
- }
- auto CheckMismatchedTypeAwareAllocators =
- [this, &TypeAwareDecls, Record](OverloadedOperatorKind NewKind,
- OverloadedOperatorKind DeleteKind) {
- auto &NewDecls = TypeAwareDecls[NewKind];
- auto &DeleteDecls = TypeAwareDecls[DeleteKind];
- if (NewDecls.empty() == DeleteDecls.empty())
- return;
- DeclarationName FoundOperator =
- Context.DeclarationNames.getCXXOperatorName(
- NewDecls.empty() ? DeleteKind : NewKind);
- DeclarationName MissingOperator =
- Context.DeclarationNames.getCXXOperatorName(
- NewDecls.empty() ? NewKind : DeleteKind);
- Diag(Record->getLocation(),
- diag::err_type_aware_allocator_missing_matching_operator)
- << FoundOperator << Context.getRecordType(Record)
- << MissingOperator;
- for (auto MD : NewDecls)
- Diag(MD->getLocation(),
- diag::note_unmatched_type_aware_allocator_declared)
- << MD;
- for (auto MD : DeleteDecls)
- Diag(MD->getLocation(),
- diag::note_unmatched_type_aware_allocator_declared)
- << MD;
- };
- CheckMismatchedTypeAwareAllocators(OO_New, OO_Delete);
- CheckMismatchedTypeAwareAllocators(OO_Array_New, OO_Array_Delete);
+ if (getLangOpts().CXXTypeAwareAllocators) {
+ llvm::SmallDenseMap<OverloadedOperatorKind,
+ llvm::SmallVector<const FunctionDecl *, 2>, 4>
+ TypeAwareDecls{{OO_New, {}},
+ {OO_Array_New, {}},
+ {OO_Delete, {}},
+ {OO_Array_New, {}}};
+ for (auto *D : Record->decls()) {
+ const FunctionDecl *FnDecl = D->getAsFunction();
+ if (!FnDecl || !FnDecl->isTypeAwareOperatorNewOrDelete())
+ continue;
+ assert(FnDecl->getDeclName().isAnyOperatorNewOrDelete());
+ TypeAwareDecls[FnDecl->getOverloadedOperator()].push_back(FnDecl);
+ }
+
+ auto CheckMismatchedTypeAwareAllocators =
+ [this, &TypeAwareDecls, Record](OverloadedOperatorKind NewKind,
+ OverloadedOperatorKind DeleteKind) {
+ auto &NewDecls = TypeAwareDecls[NewKind];
+ auto &DeleteDecls = TypeAwareDecls[DeleteKind];
+ if (NewDecls.empty() == DeleteDecls.empty())
+ return;
+ DeclarationName FoundOperator =
+ Context.DeclarationNames.getCXXOperatorName(
+ NewDecls.empty() ? DeleteKind : NewKind);
+ DeclarationName MissingOperator =
+ Context.DeclarationNames.getCXXOperatorName(
+ NewDecls.empty() ? NewKind : DeleteKind);
+ Diag(Record->getLocation(),
+ diag::err_type_aware_allocator_missing_matching_operator)
+ << FoundOperator << Context.getRecordType(Record)
+ << MissingOperator;
+ for (auto MD : NewDecls)
+ Diag(MD->getLocation(),
+ diag::note_unmatched_type_aware_allocator_declared)
+ << MD;
+ for (auto MD : DeleteDecls)
+ Diag(MD->getLocation(),
+ diag::note_unmatched_type_aware_allocator_declared)
+ << MD;
+ };
+ CheckMismatchedTypeAwareAllocators(OO_New, OO_Delete);
+ CheckMismatchedTypeAwareAllocators(OO_Array_New, OO_Array_Delete);
+ }
}
/// Look up the special member function that would be called by a special
@@ -16439,7 +16442,8 @@ bool Sema::CompleteConstructorCall(CXXConstructorDecl *Constructor,
TypeAwareAllocationMode Sema::ShouldUseTypeAwareOperatorNewOrDelete() const {
bool SeenTypedOperators = Context.hasSeenTypeAwareOperatorNewOrDelete();
- return typeAwareAllocationModeFromBool(SeenTypedOperators);
+ return typeAwareAllocationModeFromBool(getLangOpts().CXXTypeAwareAllocators &&
+ SeenTypedOperators);
}
FunctionDecl *
@@ -16587,6 +16591,11 @@ static inline bool CheckOperatorNewDeleteTypes(
unsigned MinimumMandatoryArgumentCount = 1;
unsigned SizeParameterIndex = 0;
if (IsPotentiallyTypeAware) {
+ if (!SemaRef.getLangOpts().CXXTypeAwareAllocators)
+ return SemaRef.Diag(FnDecl->getLocation(),
+ diag::err_type_aware_allocators_disabled)
+ << FnDecl->getDeclName();
+
// We don't emit this diagnosis for template instantiations as we will
// have already emitted it for the original template declaration.
if (!FnDecl->isTemplateInstantiation()) {
@@ -16699,7 +16708,7 @@ static inline bool CheckOperatorNewDeleteTypes(
return true;
FnDecl->setIsTypeAwareOperatorNewOrDelete();
- return MalformedTypeIdentity;
+ return MalformedTypeIdentity || !SemaRef.getLangOpts().CXXTypeAwareAllocators;
}
static bool CheckOperatorNewDeclaration(Sema &SemaRef, FunctionDecl *FnDecl) {
@@ -16746,6 +16755,10 @@ CheckOperatorDeleteDeclaration(Sema &SemaRef, FunctionDecl *FnDecl) {
// pile of incorrect parameter type errors.
if (MD && IsPotentiallyTypeAwareOperatorNewOrDelete(
SemaRef, MD, /*WasMalformed=*/nullptr)) {
+ if (!SemaRef.getLangOpts().CXXTypeAwareAllocators)
+ return SemaRef.Diag(FnDecl->getLocation(),
+ diag::err_type_aware_allocators_disabled)
+ << FnDecl->getDeclName();
QualType AddressParamType =
SemaRef.Context.getCanonicalType(MD->getParamDecl(1)->getType());
if (AddressParamType != SemaRef.Context.VoidPtrTy &&
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 235ea1529b0b8..ee01411729cd8 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -1768,7 +1768,7 @@ namespace {
// A function template declaration is only a usual deallocation function
// if it is a typed delete.
if (!FD) {
- if (AllocType.isNull())
+ if (AllocType.isNull() || !S.getLangOpts().CXXTypeAwareAllocators)
return;
auto *FTD = dyn_cast<FunctionTemplateDecl>(Found->getUnderlyingDecl());
if (!FTD)
@@ -1786,7 +1786,7 @@ namespace {
// type being deallocated, or if the type-identity parameter of the
// deallocation function does not match the constructed type_identity
// specialization we reject the declaration.
- if (AllocType.isNull()) {
+ if (AllocType.isNull() || !S.getLangOpts().CXXTypeAwareAllocators) {
FD = nullptr;
return;
}
diff --git a/clang/test/CodeGenCXX/type-aware-allocators.cpp b/clang/test/CodeGenCXX/type-aware-allocators.cpp
index cce9197ed0d12..7b49f1537db8a 100644
--- a/clang/test/CodeGenCXX/type-aware-allocators.cpp
+++ b/clang/test/CodeGenCXX/type-aware-allocators.cpp
@@ -1,14 +1,14 @@
-// RUN: %clang_cc1 %s -triple arm64-apple-macosx -fsized-deallocation -faligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -o - -Wno-c++26-extensions | FileCheck --check-prefixes=CHECK,CHECK_SIZED_ALIGNED %s
-// RUN: %clang_cc1 %s -triple arm64-apple-macosx -fno-sized-deallocation -faligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -o - -Wno-c++26-extensions | FileCheck --check-prefixes=CHECK,CHECK_NO_SIZE_ALIGNED %s
-// RUN: %clang_cc1 %s -triple arm64-apple-macosx -fno-sized-deallocation -fno-aligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -o - -Wno-c++26-extensions | FileCheck --check-prefixes=CHECK,CHECK_NO_SIZE_NO_ALIGN %s
-// RUN: %clang_cc1 %s -triple arm64-apple-macosx -fsized-deallocation -fno-aligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -o - -Wno-c++26-extensions | FileCheck --check-prefixes=CHECK,CHECK_SIZED_NO_ALIGN %s
+// RUN: %clang_cc1 %s -triple arm64-apple-macosx -fcxx-type-aware-allocators -fsized-deallocation -faligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -o - -Wno-c++26-extensions | FileCheck --check-prefixes=CHECK,CHECK_SIZED_ALIGNED %s
+// RUN: %clang_cc1 %s -triple arm64-apple-macosx -fcxx-type-aware-allocators -fno-sized-deallocation -faligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -o - -Wno-c++26-extensions | FileCheck --check-prefixes=CHECK,CHECK_NO_SIZE_ALIGNED %s
+// RUN: %clang_cc1 %s -triple arm64-apple-macosx -fcxx-type-aware-allocators -fno-sized-deallocation -fno-aligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -o - -Wno-c++26-extensions | FileCheck --check-prefixes=CHECK,CHECK_NO_SIZE_NO_ALIGN %s
+// RUN: %clang_cc1 %s -triple arm64-apple-macosx -fcxx-type-aware-allocators -fsized-deallocation -fno-aligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -o - -Wno-c++26-extensions | FileCheck --check-prefixes=CHECK,CHECK_SIZED_NO_ALIGN %s
+
// Test default behaviour with c++26
// RUN: %clang_cc1 %s -triple arm64-apple-macosx -fsized-deallocation -faligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++26 -o - | FileCheck --check-prefixes=CHECK,CHECK_SIZED_ALIGNED %s
// RUN: %clang_cc1 %s -triple arm64-apple-macosx -fno-sized-deallocation -faligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++26 -o - | FileCheck --check-prefixes=CHECK,CHECK_NO_SIZE_ALIGNED %s
// RUN: %clang_cc1 %s -triple arm64-apple-macosx -fno-sized-deallocation -fno-aligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++26 -o - | FileCheck --check-prefixes=CHECK,CHECK_NO_SIZE_NO_ALIGN %s
// RUN: %clang_cc1 %s -triple arm64-apple-macosx -fsized-deallocation -fno-aligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++26 -o - | FileCheck --check-prefixes=CHECK,CHECK_SIZED_NO_ALIGN %s
-
namespace std {
template <class T> struct type_identity {
typedef T type;
diff --git a/clang/test/CodeGenCXX/type-aware-coroutines.cpp b/clang/test/CodeGenCXX/type-aware-coroutines.cpp
index 0a19079d987e9..5ac314dbb5e2f 100644
--- a/clang/test/CodeGenCXX/type-aware-coroutines.cpp
+++ b/clang/test/CodeGenCXX/type-aware-coroutines.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple arm64-apple-macosx %s -std=c++23 -fcoroutines -fexceptions -emit-llvm -Wno-coro-type-aware-allocation-function -o - | FileCheck %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx %s -std=c++23 -fcxx-type-aware-allocators -fcoroutines -fexceptions -emit-llvm -Wno-coro-type-aware-allocation-function -o - | FileCheck %s
// RUN: %clang_cc1 -triple arm64-apple-macosx %s -std=c++26 -fcoroutines -fexceptions -emit-llvm -Wno-coro-type-aware-allocation-function -o - | FileCheck %s
#include "Inputs/std-coroutine.h"
diff --git a/clang/test/CodeGenCXX/type-aware-placement-operators.cpp b/clang/test/CodeGenCXX/type-aware-placement-operators.cpp
index 858db62ffcfb0..ec34b1077b749 100644
--- a/clang/test/CodeGenCXX/type-aware-placement-operators.cpp
+++ b/clang/test/CodeGenCXX/type-aware-placement-operators.cpp
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 %s -triple arm64-apple-macosx -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -fsized-deallocation -faligned-allocation -o - | FileCheck %s
-// RUN: %clang_cc1 %s -triple arm64-apple-macosx -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -fno-sized-deallocation -faligned-allocation -o - | FileCheck %s
-// RUN: %clang_cc1 %s -triple arm64-apple-macosx -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -fsized-deallocation -fno-aligned-allocation -o - | FileCheck %s
-// RUN: %clang_cc1 %s -triple arm64-apple-macosx -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -fno-aligned-allocation -fno-sized-deallocation -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple arm64-apple-macosx -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -fcxx-type-aware-allocators -fsized-deallocation -faligned-allocation -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple arm64-apple-macosx -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -fcxx-type-aware-allocators -fno-sized-deallocation -faligned-allocation -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple arm64-apple-macosx -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -fcxx-type-aware-allocators -fsized-deallocation -fno-aligned-allocation -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple arm64-apple-macosx -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -fcxx-type-aware-allocators -fno-aligned-allocation -fno-sized-deallocation -o - | FileCheck %s
namespace std {
template <class T> struct type_identity {};
diff --git a/clang/test/PCH/type-aware-destroying-new-and-delete-pch.cpp b/clang/test/PCH/type-aware-destroying-new-and-delete-pch.cpp
index d8f7f5dd50c78..b542b03b8b4fb 100644
--- a/clang/test/PCH/type-aware-destroying-new-and-delete-pch.cpp
+++ b/clang/test/PCH/type-aware-destroying-new-and-delete-pch.cpp
@@ -5,8 +5,8 @@
// RUN: %clang_cc1 -x c++ -std=c++26 -emit-pch -o %t %S/Inputs/type_aware_destroying_new_delete.h
// RUN: %clang_cc1 -x c++ -std=c++26 -include-pch %t -emit-llvm -o - %s
-// RUN: %clang_cc1 -x c++ -std=c++11 -emit-pch -fpch-instantiate-templates -o %t %S/Inputs/type_aware_destroying_new_delete.h
-// RUN: %clang_cc1 -x c++ -std=c++11 -include-pch %t -emit-llvm -o - %s
+// RUN: %clang_cc1 -x c++ -std=c++11 -fcxx-type-aware-allocators -emit-pch -fpch-instantiate-templates -o %t %S/Inputs/type_aware_destroying_new_delete.h
+// RUN: %clang_cc1 -x c++ -std=c++11 -fcxx-type-aware-allocators -include-pch %t -emit-llvm -o - %s
static void call_in_pch_function(void) {
diff --git a/clang/test/SemaCXX/type-aware-coroutines.cpp b/clang/test/SemaCXX/type-aware-coroutines.cpp
index a54d37c47dbd9..3ec3d3953db45 100644
--- a/clang/test/SemaCXX/type-aware-coroutines.cpp
+++ b/clang/test/SemaCXX/type-aware-coroutines.cpp
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s -std=c++26 -fcoroutines -fexceptions -Wall -Wpedantic
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s -std=c++26 -fcoroutines -fexceptions -Wall -Wpedantic
+// Ty...
[truncated]
|
Adding @AaronBallman and @cor3ntin as reviewers as you were the primary reviewers for the main PR, and I can't recall which of you requested I remove the flag and c++26 gating :D |
(I'm still waiting for the full test suite to finish running, boy howdy does it take a long time :D) |
I'm fairly opposed to adding this flag before Sofia - My assumption is that this is a C++26 feature (and one that is backward compatible) - and we should not add a flag for every standard feature. if the committee fails to land this in Sofia, then we can add the flag before the 21 release |
Per the feedback from the Clang Area Team, this PR makes P2719 only on by default when targeting C++26, and adds a flag to explicitly enable or disable support.