[Lldb-commits] [PATCH] D66357: Fix GetDIEForDeclContext so it only returns entries matching the provided context
    Guilherme Andrade via Phabricator via lldb-commits 
    lldb-commits at lists.llvm.org
       
    Sat Aug 17 11:50:22 PDT 2019
    
    
  
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
    
    
More information about the lldb-commits
mailing list