[ASTImporter] Fix LLDB lookup in transparent ctx and with ext src
authorGabor Marton <gabor.marton@ericsson.com>
Wed, 17 Jul 2019 13:47:46 +0000 (13:47 +0000)
committerGabor Marton <gabor.marton@ericsson.com>
Wed, 17 Jul 2019 13:47:46 +0000 (13:47 +0000)
commitaefcf5100aae57ed2ff6a15356bd25d74e8fb27e
treeb661de8e1a907195d1dbad706b84fe8a81dcbf0b
parent62069ac310654f464e65d98e92d33d16faa738ee
[ASTImporter] Fix LLDB lookup in transparent ctx and with ext src

Summary:
With LLDB we use localUncachedLookup(), however, that fails to find
Decls when a transparent context is involved and the given DC has
external lexical storage.  The solution is to use noload_lookup, which
works well with transparent contexts.  But, we cannot use only the
noload_lookup since the slow case of localUncachedLookup is still needed
in some other cases.

These other cases are handled in ASTImporterLookupTable, but we cannot
use that with LLDB since that traverses through the AST which initiates
the load of external decls again via DC::decls().

We must avoid loading external decls during the import becuase
ExternalASTSource is implemented with ASTImporter, so external loads
during import results in uncontrolled and faulty import.

Reviewers: shafik, teemperor, jingham, clayborg, a_sidorin, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits, lldb-commits

Tags: #clang, #lldb

Differential Revision: https://reviews.llvm.org/D61333

llvm-svn: 366325
clang/lib/AST/ASTImporter.cpp
clang/unittests/AST/ASTImporterTest.cpp
lldb/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py
lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp