mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 13:50:11 +00:00
[lldb] Fix buildbots after PR 74786 (#75272)
Fix unexpected pass after https://github.com/llvm/llvm-project/pull/74786.
This commit is contained in:
parent
ed2d497291
commit
dcbf1e4e49
@ -42,7 +42,7 @@ class CppUnionStaticMembersTestCase(TestBase):
|
||||
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
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user