================ @@ -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(); ---------------- mizvekov wrote:
I am a bit confused about this one. For reference, the diagnostic format for this note is: `%select{non-|}0type aware %1 declared here in %2` The note points to the `Decl`'s location, but the diagnostic says 'here in %2' which is the Decl's semantic parent. Should you adjust the note's location? Is it possible the semantic vs lexical context distinction could matter here, for example can these operators be declared as friends? Small nit for consistency: ```suggestion S.Diag(Decl->getLocation(), diag::note_type_aware_operator_declared) << /*isTypeAware=*/1 << Decl << Decl->getDeclContext(); ``` 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