[clang] [RFC] Initial implementation of P2719 (PR #113510)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 30 02:29:59 PST 2025
================
@@ -1095,12 +1095,40 @@ 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 DiagnoseTypeAwareAllocatorsIfNecessary(Sema &S, SourceLocation Loc,
+ unsigned DiagnosticID,
+ DeclarationName Name,
+ QualType PromiseType) {
+ if (!S.getLangOpts().TypeAwareAllocators)
+ return false;
+ if (!PromiseType->isRecordType())
+ return false;
+ LookupResult R(S, Name, Loc, Sema::LookupOrdinaryName);
+ S.LookupQualifiedName(R, PromiseType->getAsCXXRecordDecl());
+ bool HaveIssuedWarning = false;
+ for (auto Decl : R) {
+ if (S.isTypeAwareOperatorNewOrDelete(Decl)) {
+ if (!HaveIssuedWarning) {
+ S.Diag(Loc, DiagnosticID) << Name;
+ HaveIssuedWarning = true;
+ }
+ S.Diag(Decl->getLocation(), diag::note_type_aware_operator_declared)
+ << 0 << Decl;
----------------
cor3ntin wrote:
```suggestion
<< /*insert comment here*/ 0 << Decl;
```
https://github.com/llvm/llvm-project/pull/113510
More information about the cfe-commits
mailing list