summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/lang/cpp
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2018-05-08 03:08:46 +0000
committerFrederic Riss <friss@apple.com>2018-05-08 03:08:46 +0000
commit1739b7d076c4fc9c51158ba828d1d3eb6dfb42a8 (patch)
treec4c2b09fba270f7d79ae18954f39eb9549ab224b /lldb/packages/Python/lldbsuite/test/lang/cpp
parentd2421f9445385184569130bef05aef07a7a9692e (diff)
downloadbcm5719-llvm-1739b7d076c4fc9c51158ba828d1d3eb6dfb42a8.tar.gz
bcm5719-llvm-1739b7d076c4fc9c51158ba828d1d3eb6dfb42a8.zip
Really test type lookup in TestCppTypeLookup.py
Summary: ... and fix one bug found this way. Currently, the test works not because types are looked up correctly, but because by injecting local variables we also materialize the types for Clang. If we disable the local variable injection, then one check fails. The reason of the failure is that FindTypes is run with max_matches==1 and this value is passed down to the symbol lookup functions. When the search is performed only on the basename (like it's the case for an entity defined in the root namespace), then the search will stop after having found one match on the basename. But that match might be in a namespace, we were really just looking up the basename in the accelerator tables. The solution is to not pass max_matches down, but to search without a limit and let RemoveMismatchedTypes do its job afterwards. Note the patch includes 2 hunks with the same change, but only the latter is tested. I couldn't find a way to create a testcase for the other branch of the if ('image lookup -t' allows me to get there, but it only ever returns one type anyway). Reviewers: clayborg, jingham Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D46548 llvm-svn: 331719
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lang/cpp')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/type_lookup/TestCppTypeLookup.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/type_lookup/TestCppTypeLookup.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/type_lookup/TestCppTypeLookup.py
index 8fb003bb650..94d52e368e8 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/type_lookup/TestCppTypeLookup.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/type_lookup/TestCppTypeLookup.py
@@ -38,6 +38,11 @@ class TestCppTypeLookup(TestBase):
# Get frame for current thread
frame = thread.GetSelectedFrame()
+ # We are testing LLDB's type lookup machinery, but if we inject local
+ # variables, the types for those will be found because they have been
+ # imported through the variable, not because the type lookup worked.
+ self.runCmd("settings set target.experimental.inject-local-vars false")
+
# Make sure we don't accidentally accept structures that exist only
# in namespaces when evaluating expressions with top level types.
# Prior to the revision that added this test, we would accidentally
OpenPOWER on IntegriCloud