================
@@ -1013,6 +1013,17 @@ void Sema::InstantiateAttrs(const
MultiLevelTemplateArgumentList &TemplateArgs,
continue;
}
+ if (auto *A = dyn_cast<ReturnsNonNullAttr>(TmplAttr)) {
+ auto *FD = cast<FunctionDecl>(New);
+ QualType ResultType = getFunctionOrMethodResultType(FD);
+ if (!isValidPointerAttrType(ResultType))
+ Diag(A->getLocation(), diag::warn_attribute_return_pointers_only)
+ << A << SourceRange() << getFunctionOrMethodResultSourceRange(FD);
+ else if (!New->hasAttr<ReturnsNonNullAttr>())
+ New->addAttr(A->clone(Context));
+ continue;
+ }
+
----------------
erichkeane wrote:
This function isn't for doing real work like this, we should be splitting off
the instantiation of this attribute off to a separate function, see how
`instantiateDependentAlignedAttr` and others do this.
THAT function needs to share as much checking as possible with the
non-dependent checking (as the others do).
The purpose of that/this is that we intend to try to tablegen this table at one
point, and the more this diverges from that pattern, the less likely we are to
be able tod o that sanely.
https://github.com/llvm/llvm-project/pull/200117
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits