Skip to content

[lldb][PDB] Update max matches test for type queries #75813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

DavidSpickett
Copy link
Collaborator

NestedClass will be found via Class::NestedClass and ClassTypedef::NestedClass. So the first part of the test gets 2 results as the default is to find all matching types.

In the next part, we ask for only the first match and expect to get only 1 of those two possible results.

NestedClass will be found via Class::NestedClass and
ClassTypedef::NestedClass. So the first part of the test
gets 2 results as the default is to find all matching types.

In the next part, we ask for only the first match and
expect to get only 1 of those two possible results.
@llvmbot
Copy link
Member

llvmbot commented Dec 18, 2023

@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)

Changes

NestedClass will be found via Class::NestedClass and ClassTypedef::NestedClass. So the first part of the test gets 2 results as the default is to find all matching types.

In the next part, we ask for only the first match and expect to get only 1 of those two possible results.


Full diff: https://github.com/llvm/llvm-project/pull/75813.diff

1 Files Affected:

  • (modified) lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp (+3-13)
diff --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
index 07e3a0c8ee95d2..6a2ea8c4a41b1c 100644
--- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
+++ b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
@@ -579,24 +579,14 @@ TEST_F(SymbolFilePDBTests, TestMaxMatches) {
       static_cast<SymbolFilePDB *>(module->GetSymbolFile());
 
   // Make a type query object we can use for all types and for one type
-  //
-  // TODO: this test was ported as is and before the new FindTypes patch
-  // this test was trying to find all matches, and it would find one. Then
-  // it would limit its number of matches from zero to < the minimum of the
-  // number of matches that were found in the first search, or 10. Then it
-  // would set the max matches to that number (1) and verify it was the
-  // same (1). This test should be fixed in the figure by updating the
-  // lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp file and
-  // recompiling the exe + pdb file so that there are actually multiple
-  // types whose basename is "ClassTypedef" or any other type. Now type
-  // matches only return a single match, or all of the matches.
-  TypeQuery query("ClassTypedef");
+  TypeQuery query("NestedClass");
   {
     // Find all types that match
     TypeResults query_results;
     symfile->FindTypes(query, query_results);
     TypeMap &results = query_results.GetTypeMap();
-    EXPECT_EQ(results.GetSize(), 1u);
+    // We expect to find Class::NestedClass and ClassTypedef::NestedClass.
+    EXPECT_EQ(results.GetSize(), 2u);
   }
   {
     // Find a single type that matches

Copy link
Member

@bulbazord bulbazord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good clean up to me!

Copy link
Collaborator

@clayborg clayborg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing properly!

@DavidSpickett DavidSpickett merged commit 87bf1af into llvm:main Dec 19, 2023
@DavidSpickett DavidSpickett deleted the lldb-pdb branch December 19, 2023 08:54
kendalharland pushed a commit to kendalharland/llvm-project that referenced this pull request Aug 8, 2024
NestedClass will be found via Class::NestedClass and
ClassTypedef::NestedClass. So the first part of the test gets 2 results
as the default is to find all matching types.

In the next part, we ask for only the first match and expect to get only
1 of those two possible results.

(cherry picked from commit 87bf1af)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants