rsmith added a comment.

Ah, I see.

In D147782#4251185 <https://reviews.llvm.org/D147782#4251185>, @J-Camilleri 
wrote:

> 2. Have the `IdResolver` declarations ordered by scope, going from most 
> nested to least nested.

This is the intended behavior. But `Sema::PushOnScopeChains` doesn't correctly 
handle declarations being added in non-lexical order, except for label 
declarations, which are special-cased.

I think probably the cleanest fix would be to add a flag to `PushOnScopeChains` 
to indicate that the scope to which we're adding the name may not be the 
innermost scope, and so we should find the correct insertion point (like we 
already do for `LabelDecl`s). We should then set that flag when calling 
`PushOnScopeChains` with a scope that's not necessarily the innermost scope, 
such as from `Sema::DeclareImplicit*`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147782

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D147782: ... Jonathan Camilleri via Phabricator via cfe-commits
    • [PATCH] D147... Jonathan Camilleri via Phabricator via cfe-commits
    • [PATCH] D147... Shafik Yaghmour via Phabricator via cfe-commits
    • [PATCH] D147... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D147... Richard Smith - zygoloid via Phabricator via cfe-commits

Reply via email to