================ @@ -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:
But my original question, can these operators be declared as friends? For a friend function, the semantic context and lexical context are different. A friend function can be lexically inside a class, but semantically in the TU or namespace. I think in this case you may want getLexicalDeclContext instead of 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