[PATCH] D136533: [clang] Fix missing diagnostic of declaration use when accessing TypeDecls through typename access

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 08:07:14 PDT 2022


mizvekov added a comment.

In D136533#3896313 <https://reviews.llvm.org/D136533#3896313>, @ldionne wrote:

> Looking at that commit, which had nothing to do with fixing availability markup, I think this Clang patch might still be missing some diagnostics? Should it diagnose when the typename is accessed through an alias?
>
> If that's the case, libc++ would fail with trunk as well, since `5fab33af7f083` would not silence these issues. And if that's the case, then I am not sure how to fix libc++ at all. I suspect the problem here is really https://github.com/llvm/llvm-project/issues/40340, since we do mark the filesystem classes as unavailable as we should.

It's quite possible it's missing other cases, there isn't a general helper in clang to access a declaration which would 'automatically' perform the use-checking, so I expect a lot of places to be repeating code / calling low level accessors which do not.

I haven't come across an issue with type aliases, though I am not on a personal crusade to fix all these right now, this just came across while I was working on something else.

Now that you mention it, looking at the code, I think we don't diagnose an use of a type alias itself, if that is what you mean?

Ie, clang doesn't, GCC does, MSVC doesn't: https://godbolt.org/z/WEo4enjbz

Would fixing that be a problem for libc++?

Otherwise, typename accesses through the type alias pattern itself should work like from any context, except that if the access happens through a dependent entity, we should be diagnosing it when we instantiate the type alias.

Does what you are talking about fall into any of that? Otherwise, do you have a short example?

----

Otherwise, if current libc++ is fine and building older libc++with newer clang is not supported, is everyone fine with merging this back, as is?
@thakis ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136533/new/

https://reviews.llvm.org/D136533



More information about the cfe-commits mailing list