[PATCH] D133945: [clang][ASTImporter] DeclContext::localUncachedLookup: Continue lookup into decl chain when regular lookup fails

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 16 01:42:57 PDT 2022


martong accepted this revision.
martong added a comment.
This revision is now accepted and ready to land.

LGTM, Thanks!



================
Comment at: clang/lib/AST/DeclBase.cpp:1781
   if (Name && !hasLazyLocalLexicalLookups() &&
       !hasLazyExternalLexicalLookups()) {
     if (StoredDeclsMap *Map = LookupPtr) {
----------------
Michael137 wrote:
> Michael137 wrote:
> > Could merge the two if-blocks now I suppose
> Nevermind, not true
Yeah, we set HasLazyExternalLexicalLookups to true in https://reviews.llvm.org/D61333 exactly for the reason to continue the lookup into decl chain.


================
Comment at: clang/unittests/AST/ASTImporterTest.cpp:4927-4929
+  // Finds via linear search of its LexicalDC (A).
   FooLexicalDC->getRedeclContext()->localUncachedLookup(FooName, FoundDecls);
+  EXPECT_EQ(FoundDecls.size(), 1u);
----------------
Very good, now the behavior is the same that we have in case of the `ASTImporterLookupTable`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133945



More information about the cfe-commits mailing list