[PATCH] SemaCXX: Support templates in availability attributes
Manman Ren via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 22 17:24:40 PST 2016
> On Feb 8, 2016, at 8:17 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
>
> This patch adds support for templates in availability attributes.
> - If the context for an availability diagnostic is a
> `FunctionTemplateDecl`, look through it to the `FunctionDecl`.
> AvailabilityResult Decl::getAvailability(std::string *Message) const {
> + if (auto *FTD = dyn_cast<FunctionTemplateDecl>(this))
> + return FTD->getTemplatedDecl()->getAvailability(Message);
> +
> AvailabilityResult Result = AR_Available;
This looks generally correct to me.
The UnavailableAttr is attached to the FunctionDecl, not the FunctionTemplateDecl, so looking through sounds right.
> - Add `__has_feature(attribute_availability_in_templates)`.
>
> Is there anything else I should be testing to be sure availability
> works correctly in templates?
Maybe
test<UnavailableClass>()
calling unavailable function from an unavailable template function
calling an unavailable template function
I think these all work with the current compiler. But I am not sure if we have existing test coverage.
Cheers,
Manman
> I'm working on a patch to add
> availability markup to the libc++ headers, and this is the only
> problem I've hit so far. Anyone have thoughts on other things I
> should test?
>
> <0001-SemaCXX-Support-templates-in-availability-attributes.patch>
More information about the cfe-commits
mailing list