[Lldb-commits] [lldb] [lldb] Fix buildbots after PR 74786 (PR #75272)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 12 18:57:48 PST 2023


https://github.com/clayborg updated https://github.com/llvm/llvm-project/pull/75272

>From 5646faa2b21fe01f8a379beda1ca77190c0df1f1 Mon Sep 17 00:00:00 2001
From: Greg Clayton <clayborg at gmail.com>
Date: Tue, 12 Dec 2023 18:16:04 -0800
Subject: [PATCH 1/2] [lldb] Fix buildbots after PR 74786

Fix unexpected pass after https://github.com/llvm/llvm-project/pull/74786.
---
 .../cpp/union-static-data-members/TestCppUnionStaticMembers.py  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/test/API/lang/cpp/union-static-data-members/TestCppUnionStaticMembers.py b/lldb/test/API/lang/cpp/union-static-data-members/TestCppUnionStaticMembers.py
index 1988e997499b22..dff23da8662a04 100644
--- a/lldb/test/API/lang/cpp/union-static-data-members/TestCppUnionStaticMembers.py
+++ b/lldb/test/API/lang/cpp/union-static-data-members/TestCppUnionStaticMembers.py
@@ -42,7 +42,7 @@ def test_expr_union_static_members(self):
                 name="val", value="42"
             )])
 
-    @expectedFailureAll
+    @expectedFailureWindows
     def test_union_in_anon_namespace(self):
         """Tests that frame variable and expr work
            for union static data members in anonymous

>From 7ee5696f02eeafd053b7422b108d7ba81e1db689 Mon Sep 17 00:00:00 2001
From: Greg Clayton <clayborg at gmail.com>
Date: Tue, 12 Dec 2023 18:57:23 -0800
Subject: [PATCH 2/2] Add fixes for windows buildbots.

---
 .../SymbolFile/PDB/SymbolFilePDBTests.cpp     | 91 ++++++++++---------
 1 file changed, 46 insertions(+), 45 deletions(-)

diff --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
index acd381ccad13d2..afa600a89cbc0f 100644
--- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
+++ b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
@@ -362,10 +362,9 @@ TEST_F(SymbolFilePDBTests, TestSimpleClassTypes) {
   SymbolFilePDB *symfile =
       static_cast<SymbolFilePDB *>(module->GetSymbolFile());
   llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
-  llvm::DenseSet<SymbolFile *> searched_files;
-  TypeMap results;
-  symfile->FindTypes(ConstString("Class"), CompilerDeclContext(), 0,
-                     searched_files, results);
+  TypeResults query_results;
+  symfile->FindTypes(TypeQuery("Class"), query_results);
+  TypeMap &results = query_results.GetTypeMap();
   EXPECT_EQ(1u, results.GetSize());
   lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
   EXPECT_EQ(ConstString("Class"), udt_type->GetName());
@@ -383,7 +382,6 @@ TEST_F(SymbolFilePDBTests, TestNestedClassTypes) {
   SymbolFilePDB *symfile =
       static_cast<SymbolFilePDB *>(module->GetSymbolFile());
   llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
-  llvm::DenseSet<SymbolFile *> searched_files;
   TypeMap results;
 
   auto clang_ast_ctx_or_err =
@@ -394,8 +392,10 @@ TEST_F(SymbolFilePDBTests, TestNestedClassTypes) {
       llvm::dyn_cast_or_null<TypeSystemClang>(clang_ast_ctx_or_err->get());
   EXPECT_NE(nullptr, clang_ast_ctx);
 
-  symfile->FindTypes(ConstString("Class"), CompilerDeclContext(), 0,
-                     searched_files, results);
+  TypeResults query_results;
+  symfile->FindTypes(TypeQuery("Class"), query_results);
+  TypeMap &results = query_results.GetTypeMap();
+
   EXPECT_EQ(1u, results.GetSize());
 
   auto Class = results.GetTypeAtIndex(0);
@@ -413,10 +413,11 @@ TEST_F(SymbolFilePDBTests, TestNestedClassTypes) {
   // compiler type for both, but `FindTypes` may return more than one type
   // (with the same compiler type) because the symbols have different IDs.
 
-  TypeMap more_results;
   auto ClassCompilerDeclCtx = CompilerDeclContext(clang_ast_ctx, ClassDeclCtx);
-  symfile->FindTypes(ConstString("NestedClass"), ClassCompilerDeclCtx, 0,
-                     searched_files, more_results);
+  TypeResults query_results;
+  symfile->FindTypes(TypeQuery(ClassCompilerDeclCtx, "NestedClass"),
+                     query_results);
+  TypeMap &more_results = query_results.GetTypeMap();
   EXPECT_LE(1u, more_results.GetSize());
 
   lldb::TypeSP udt_type = more_results.GetTypeAtIndex(0);
@@ -437,9 +438,6 @@ TEST_F(SymbolFilePDBTests, TestClassInNamespace) {
   SymbolFilePDB *symfile =
       static_cast<SymbolFilePDB *>(module->GetSymbolFile());
   llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
-  llvm::DenseSet<SymbolFile *> searched_files;
-  TypeMap results;
-
   auto clang_ast_ctx_or_err =
       symfile->GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
   ASSERT_THAT_EXPECTED(clang_ast_ctx_or_err, llvm::Succeeded());
@@ -456,12 +454,14 @@ TEST_F(SymbolFilePDBTests, TestClassInNamespace) {
   symfile->ParseDeclsForContext(CompilerDeclContext(
       clang_ast_ctx, static_cast<clang::DeclContext *>(tu)));
 
-  auto ns_namespace =
+  auto ns_namespace_decl_ctx =
       symfile->FindNamespace(ConstString("NS"), CompilerDeclContext(), true);
-  EXPECT_TRUE(ns_namespace.IsValid());
+  EXPECT_TRUE(ns_namespace_decl_ctx.IsValid());
 
-  symfile->FindTypes(ConstString("NSClass"), ns_namespace, 0, searched_files,
-                     results);
+  TypeResults query_results;
+  symfile->FindTypes(TypeQuery(ns_namespace_decl_ctx, "NSClass"),
+                     query_results);
+  TypeMap &results = query_results.GetTypeMap();
   EXPECT_EQ(1u, results.GetSize());
 
   lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
@@ -482,12 +482,12 @@ TEST_F(SymbolFilePDBTests, TestEnumTypes) {
   SymbolFilePDB *symfile =
       static_cast<SymbolFilePDB *>(module->GetSymbolFile());
   llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
-  llvm::DenseSet<SymbolFile *> searched_files;
   const char *EnumsToCheck[] = {"Enum", "ShortEnum"};
   for (auto Enum : EnumsToCheck) {
-    TypeMap results;
-    symfile->FindTypes(ConstString(Enum), CompilerDeclContext(), 0,
-                       searched_files, results);
+
+    TypeResults query_results;
+    symfile->FindTypes(TypeQuery(Enum), query_results);
+    TypeMap &results = query_results.GetTypeMap();
     EXPECT_EQ(1u, results.GetSize());
     lldb::TypeSP enum_type = results.GetTypeAtIndex(0);
     EXPECT_EQ(ConstString(Enum), enum_type->GetName());
@@ -527,16 +527,15 @@ TEST_F(SymbolFilePDBTests, TestTypedefs) {
   SymbolFilePDB *symfile =
       static_cast<SymbolFilePDB *>(module->GetSymbolFile());
   llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
-  llvm::DenseSet<SymbolFile *> searched_files;
   TypeMap results;
 
   const char *TypedefsToCheck[] = {"ClassTypedef", "NSClassTypedef",
                                    "FuncPointerTypedef",
                                    "VariadicFuncPointerTypedef"};
   for (auto Typedef : TypedefsToCheck) {
-    TypeMap results;
-    symfile->FindTypes(ConstString(Typedef), CompilerDeclContext(), 0,
-                       searched_files, results);
+    TypeResults query_results;
+    symfile->FindTypes(TypeQuery(Typedef), query_results);
+    TypeMap &results = query_results.GetTypeMap();
     EXPECT_EQ(1u, results.GetSize());
     lldb::TypeSP typedef_type = results.GetTypeAtIndex(0);
     EXPECT_EQ(ConstString(Typedef), typedef_type->GetName());
@@ -578,22 +577,24 @@ TEST_F(SymbolFilePDBTests, TestMaxMatches) {
 
   SymbolFilePDB *symfile =
       static_cast<SymbolFilePDB *>(module->GetSymbolFile());
-  llvm::DenseSet<SymbolFile *> searched_files;
-  TypeMap results;
-  const ConstString name("ClassTypedef");
-  symfile->FindTypes(name, CompilerDeclContext(), 0, searched_files, results);
-  // Try to limit ourselves from 1 to 10 results, otherwise we could
-  // be doing this thousands of times.  The idea is just to make sure
-  // that for a variety of values, the number of limited results
-  // always comes out to the number we are expecting.
-  uint32_t num_results = results.GetSize();
-  uint32_t iterations = std::min(num_results, 10u);
-  for (uint32_t i = 1; i <= iterations; ++i) {
-    TypeMap more_results;
-    symfile->FindTypes(name, CompilerDeclContext(), i, searched_files,
-                       more_results);
-    uint32_t num_limited_results = more_results.GetSize();
-    EXPECT_EQ(i, num_limited_results);
+
+  // Make a type query object we can use for all types and for one type
+  TypeQuery query("ClassTypedef");
+  {
+    // Find all types that match
+    TypeResults query_results;
+    symfile->FindTypes(query, query_results);
+    TypeMap &results = query_results.GetTypeMap();
+    EXPECT_GT(results.GetSize(), 1u);
+  }
+
+  {
+    // Find a single type that matches
+    query.SetFindOne(true);
+    TypeResults query_results;
+    symfile->FindTypes(query, query_results);
+    TypeMap &results = query_results.GetTypeMap();
+    EXPECT_EQ(results.GetSize(), 1u);
   }
 }
 
@@ -604,10 +605,10 @@ TEST_F(SymbolFilePDBTests, TestNullName) {
 
   SymbolFilePDB *symfile =
       static_cast<SymbolFilePDB *>(module->GetSymbolFile());
-  llvm::DenseSet<SymbolFile *> searched_files;
-  TypeMap results;
-  symfile->FindTypes(ConstString(), CompilerDeclContext(), 0, searched_files,
-                     results);
+
+  TypeResults query_results;
+  symfile->FindTypes(TypeQuery(llvm::StringRef()), query_results);
+  TypeMap &results = query_results.GetTypeMap();
   EXPECT_EQ(0u, results.GetSize());
 }
 



More information about the lldb-commits mailing list