guiandrade added a comment.

In D66357#1633461 <https://reviews.llvm.org/D66357#1633461>, @clayborg wrote:

> Needs a test, but looks good.


Sure, I agree. Though, it's not total clear to me how we could do that.

I imagined something like the following.

  TEST_F(DWARFASTParserClangTests,
         TestGetDIEForDeclContextReturnsOnlyMatchingEntries) {
    auto ast = ClangASTContext(...);
    auto ast_parser = DWARFASTParserClang(ast);
    CompilerDeclContext decl1(nullptr, (void *)1LL);
    CompilerDeclContext decl2(nullptr, (void *)2LL);
    CompilerDeclContext decl3(nullptr, (void *)2LL);
    CompilerDeclContext decl4(nullptr, (void *)3LL);
    ast_parser->LinkDeclContextToDIE(decl1, DWARFDIE());
    ast_parser->LinkDeclContextToDIE(decl2, DWARFDIE());
    ast_parser->LinkDeclContextToDIE(decl3, DWARFDIE());
    ast_parser->LinkDeclContextToDIE(decl4, DWARFDIE());
  
    auto decl_ctx_die_list = ast_parser->GetDIEForDeclContext(decl2);
    EXPECT_EQ(2u, decl_ctx_die_list.size());
    EXPECT_EQ(decl2.GetOpaqueDeclContext(),
              decl_ctx_die_list[0].GetDeclContext().GetOpaqueDeclContext());
    EXPECT_EQ(decl3.GetOpaqueDeclContext(),
              decl_ctx_die_list[1].GetDeclContext().GetOpaqueDeclContext());
  }

But DWARFASTParserClang::LinkDeclContextToDIE is protected. Do you have any 
ideas to overcome that?

Thanks!


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66357/new/

https://reviews.llvm.org/D66357



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to