[all-commits] [llvm/llvm-project] 60eb1d: [Modules] [Sema] Don't try to getAcceptableDecls d...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Thu Jun 8 20:44:11 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 60eb1da315559a9e20f9bf502fd10ba68f6d4085
      https://github.com/llvm/llvm-project/commit/60eb1da315559a9e20f9bf502fd10ba68f6d4085
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2023-06-09 (Fri, 09 Jun 2023)

  Changed paths:
    M clang/lib/Sema/SemaLookup.cpp
    M clang/unittests/Sema/CMakeLists.txt
    A clang/unittests/Sema/SemaNoloadLookupTest.cpp

  Log Message:
  -----------
  [Modules] [Sema] Don't try to getAcceptableDecls during the iteration of noload_lookups

I found this during the support of modules for clangd. The reason for
the issue is that the iterator returned by noload_lookups is fast-fail
after the lookup table changes by the design of llvm::DenseMap. And
originally the lookup will try to use getAcceptableDecl to filter the
invisible decls. The key point here is that the function
"getAcceptableDecl" wouldn't stop after it find the specific decl is
invisble. It will continue to visit its redecls to find a visible one.
However, such process involves loading decls from external sources,
which results the invalidation.

Note that the use of "noload_lookups" is rare. It is only used in tools
like FixTypos and CodeCompletions. So it is completely fine for the
tranditional compiler. This is the reason why I can't reproduce it by a
lit test.




More information about the All-commits mailing list