[PATCH] D113709: Don't consider `LinkageSpec` when calculating DeclContext `Encloses`
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 18 08:48:10 PST 2021
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.
> We don't properly handle lookup through using declarations when there is a linkage spec in the common chain.
Pedantic note: you mean using *directives*.
At some point, we should probably reconsider whether `extern "C"` ought to be a `DeclContext` at all, as opposed to ultimately just setting a bit on the decls and providing some way of recovering the source structure. We don't make individual local scopes different DCs, and those probably have more right to be one than LSD.
Anyway, this patch seems acceptable.
================
Comment at: clang/lib/AST/DeclBase.cpp:1215
for (; DC; DC = DC->getParent())
- if (DC->getPrimaryContext() == this)
+ if (DC->getDeclKind() != Decl::LinkageSpec &&
+ DC->getPrimaryContext() == this)
----------------
`!isa<LinkageSpecDecl>(DC)`, please
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113709/new/
https://reviews.llvm.org/D113709
More information about the cfe-commits
mailing list