================
@@ -250,6 +250,61 @@ void Sema::inferLifetimeBoundAttribute(FunctionDecl *FD) {
}
return;
}
+
+ // Handle std::make_unique to propagate lifetimebound attributes from the
+ // constructed type's constructor to make_unique's parameters.
+ if (FD->isInStdNamespace() && FD->getDeclName().isIdentifier() &&
+ FD->getName() == "make_unique") {
+ if (!FD->isFunctionTemplateSpecialization())
+ return;
+
+ const TemplateArgumentList *TAL = FD->getTemplateSpecializationArgs();
+ if (!TAL || TAL->size() < 1)
----------------
Xazax-hun wrote:
Are there cases where we have an empty template argument list or (below) the
template argument is not a type? I guess it can definitely happen with
non-conforming standard libraries but I wonder if that is something we need to
protect against. That being said I don't have a strong opinion here.
https://github.com/llvm/llvm-project/pull/191632
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits