llvm-project/lldb/packages/Python/lldbsuite/test/functionalities
Raphael Isemann 51e0bbb02d [lldb][modern-type-lookup] No longer import temporary declarations into the persistent AST
Summary:
As we figured out in D67803, importing declarations from a temporary ASTContext that were originally from a persistent ASTContext
causes a bunch of duplicated declarations where we end up having declarations in the target AST that have no associated ASTImporter that
can complete them.

I haven't figured out how/if we can solve this in the current way we do things in LLDB, but in the modern-type-lookup this is solvable
as we have a saner architecture with the ExternalASTMerger. As we can (hopefully) make modern-type-lookup the default mode in the future,
I would say we try fixing this issue here. As we don't use the hack that was reinstated in D67803 during modern-type-lookup, the test case for this
is essentially just printing any kind of container in `std::` as we would otherwise run into the issue that required a hack like D67803.

What this patch is doing in essence is that instead of importing a declaration from a temporary ASTContext, we instead check if the
declaration originally came from a persistent ASTContext (e.g. the debug information) and we directly import from there. The ExternalASTMerger
is already connected with ASTImporters to these different sources, so this patch is essentially just two parts:
1. Mark our temporary ASTContext/ImporterSource as temporary when we import from the expression AST.
2. If the ExternalASTMerger sees we import from the expression AST, instead of trying to import these temporary declarations, check if we
can instead import from the persistent ASTContext that is already connected. This ensures that all records from the persistent source actually
come from the persistent source and are minimally imported in a way that allows them to be completed later on in the target AST.

The next step is to run the ASTImporter for these temporary expressions with the MinimalImport mode disabled, but that's a follow up patch.

This patch fixes most test failures with modern-type-lookup enabled by default (down to 73 failing tests, which includes the 22 import-std-module tests
which need special treatment).

Reviewers: shafik, martong

Reviewed By: martong

Subscribers: aprantl, rnkovacs, christof, abidh, JDevlieghere, lldb-commits

Tags: #lldb

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

llvm-svn: 373711
2019-10-04 08:26:17 +00:00
..
abbreviation [lldb][NFC] Remove unused imports in python tests 2019-08-02 08:06:22 +00:00
alias
archives Revert: [lldb] [testsuite] Remove redundant MAKE_DSYM := NO 2019-09-27 18:52:34 +00:00
asan [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
avoids-fd-leak [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
backticks [lldb][NFC] Remove unused imports in python tests 2019-08-02 08:06:22 +00:00
breakpoint Break out the Python class & key/value options into a separate OptionGroup. 2019-10-03 22:18:51 +00:00
completion [lldb][NFC] Relax completion tests for log command to make them pass on Linux 2019-09-24 08:41:10 +00:00
conditional_break [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
darwin_log [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
data-formatter Disable the empty string check in TestDataFormatterStdString 2019-09-27 11:39:27 +00:00
dead-strip Revert: [lldb] [testsuite] Remove redundant MAKE_DSYM := NO 2019-09-27 18:52:34 +00:00
deleted-executable [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
dynamic_value_child_count [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
exec [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
fat_archives [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
float-display [lldb] Limit the amount of zeroes we use for padding when printing small floats 2019-09-04 11:41:23 +00:00
gdb_remote_client The setUp/tearDown methods I added mssed up the test function; reorder. 2019-09-13 00:01:49 +00:00
history [lldb][NFC] Remove unused imports in python tests 2019-08-02 08:06:22 +00:00
inferior-assert [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
inferior-changed [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
inferior-crashing Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
inline-stepping Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
jitloader_gdb [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
load_unload [test] Escape path to match the literal string 2019-09-04 21:18:46 +00:00
load_using_paths [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
longjmp [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
memory [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
memory-region [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
modern-type-lookup [lldb][modern-type-lookup] No longer import temporary declarations into the persistent AST 2019-10-04 08:26:17 +00:00
mtc/simple Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
multidebugger_commands [lldb][NFC] Remove unused imports in python tests 2019-08-02 08:06:22 +00:00
multiword-commands [lldb] Print an error message for an empty subcommand 2019-09-27 08:49:41 +00:00
non-overlapping-index-variable-i [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
object-file [Platform] Remove Kalimba Platform 2019-03-27 16:23:50 +00:00
param_entry_vals/basic_entry_values_x86_64 [test] Make TestBasicEntryValuesX86_64 run on Linux as well as Darwin 2019-09-30 17:11:46 +00:00
paths [lldb][NFC] Remove unused imports in python tests 2019-08-02 08:06:22 +00:00
plugins Revert: [lldb] [testsuite] Remove redundant MAKE_DSYM := NO 2019-09-27 18:52:34 +00:00
postmortem Fix ELF core file memory reading for PT_LOAD program headers with no p_filesz 2019-09-09 21:45:49 +00:00
pre_run_dylibs [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
process_group [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
process_save_core [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
ptr_refs [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
recursion [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
rerun [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
return-value [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
set-data Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
show_location [LLDB] - Improved DWARF5 support. 2018-09-13 17:06:47 +00:00
signal [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
source-map Add the source directory for https://reviews.llvm.org/D57552. 2019-02-06 00:52:04 +00:00
stats_api [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
step-avoids-no-debug [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
step_scripted Pass an SBStructuredData to scripted ThreadPlans on use. 2019-10-03 22:50:18 +00:00
tail_call_frames Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
target-new-solib-notifications [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
target_var [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
testid add a simple test case to validate test id() 2016-10-03 22:49:13 +00:00
thread Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
tsan [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
tty [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
type_completion [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
type_lookup Canonicalize variable usage in testsuite Makefiles 2019-09-25 00:36:00 +00:00
ubsan [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
unwind [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
value_md5_crash [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
var_path [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
wrong_commands [lldb][NFC] Remove unused imports in python tests 2019-08-02 08:06:22 +00:00