[clang] [RFC] Initial implementation of P2719 (PR #113510)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 31 19:18:08 PDT 2025
================
@@ -1098,12 +1098,39 @@ static TypeSourceInfo *getTypeSourceInfoForStdAlignValT(Sema &S,
return S.Context.getTrivialTypeSourceInfo(StdAlignValDecl);
}
+// When searching for custom allocators on the PromiseType we want to
+// warn that we will ignore type aware allocators.
+static bool DiagnoseTypeAwareAllocators(Sema &S, SourceLocation Loc,
+ unsigned DiagnosticID,
+ DeclarationName Name,
+ QualType PromiseType) {
+ assert(PromiseType->isRecordType());
+
+ LookupResult R(S, Name, Loc, Sema::LookupOrdinaryName);
+ S.LookupQualifiedName(R, PromiseType->getAsCXXRecordDecl());
+ bool HaveIssuedWarning = false;
+ for (auto Decl : R) {
+ if (!Decl->getAsFunction()->isTypeAwareOperatorNewOrDelete())
+ continue;
+ if (!HaveIssuedWarning) {
+ S.Diag(Loc, DiagnosticID) << Name;
+ HaveIssuedWarning = true;
+ }
+ S.Diag(Decl->getLocation(), diag::note_type_aware_operator_declared)
+ << /* isTypeAware */ 1 << Decl << Decl->getDeclContext();
----------------
ojhunt wrote:
My rationale is that while we are pointing to the operator decl directly, depending on the class (size or complexity hierarchy) having the declared scope immediately in the diagnostic note seemed useful? I can remove it if we think it's really unnecessary.
For the style nit I'll do a quick search for any similar patterns of missing the = in the commnet
https://github.com/llvm/llvm-project/pull/113510
More information about the cfe-commits
mailing list