[PATCH] D147283: [Sema] Search template parameter scopes before searching namespace/file scopes when performing unqualified name lookup

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 19 12:54:12 PDT 2023


ahatanak added inline comments.


================
Comment at: clang/lib/Sema/SemaLookup.cpp:1392
-          if (!VisitedUsingDirectives) {
-            // Add using directives from this context up to the top level.
-            for (DeclContext *UCtx = Ctx; UCtx; UCtx = UCtx->getParent()) {
----------------
I noticed that we aren't visiting the contexts from the inside out despite the comment here: https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaLookup.cpp#L133

```
    // A given context is only every visited once, so it is important
    // that contexts be visited from the inside out in order to get
    // the effective DCs right.
```

But I think that's OK. I haven't been able to come up with an example where this is causing a problem.


================
Comment at: clang/lib/Sema/SemaLookup.cpp:1428
   // FIXME:  This really, really shouldn't be happening.
   if (!S) return false;
 
----------------
I think this line can be moved to the beginning of the function .I can try that after committing this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147283



More information about the cfe-commits mailing list