aeubanks updated this revision to Diff 472770. aeubanks added a comment. move retry into SymbolFileDWARF add tests for non-member functions
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D137098/new/ https://reviews.llvm.org/D137098 Files: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py lldb/test/API/functionalities/breakpoint/cpp/main.cpp
Index: lldb/test/API/functionalities/breakpoint/cpp/main.cpp =================================================================== --- lldb/test/API/functionalities/breakpoint/cpp/main.cpp +++ lldb/test/API/functionalities/breakpoint/cpp/main.cpp @@ -94,6 +94,8 @@ template <typename T> void operator<<(T t) {} }; + +template <typename Type> void g() {} } // namespace ns int main (int argc, char const *argv[]) @@ -123,5 +125,8 @@ f.operator<<(5); f.operator<< <ns::Foo<int>>({}); + ns::g<int>(); + ns::g<char>(); + return 0; } Index: lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py =================================================================== --- lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py +++ lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py @@ -12,7 +12,16 @@ @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764") def test(self): - self.build() + self.do_test(dict()) + + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764") + @skipIf(compiler=no_match("clang")) + @skipIf(compiler_version=["<", "15.0"]) + def test_simple_template_names(self): + self.do_test(dict(CFLAGS_EXTRAS="-gsimple-template-names")) + + def do_test(self, debug_flags): + self.build(dictionary=debug_flags) self.breakpoint_id_tests() def verify_breakpoint_locations(self, target, bp_dict): @@ -57,7 +66,11 @@ # Template cases {'name': 'func<float>', 'loc_names': []}, + {'name': 'Foo::func<float>', 'loc_names': []}, + {'name': 'ns::Foo::func<float>', 'loc_names': []}, {'name': 'func<int>', 'loc_names': ['auto ns::Foo<double>::func<int>()']}, + {'name': 'Foo<double>::func<int>', 'loc_names': ['auto ns::Foo<double>::func<int>()']}, + {'name': 'ns::Foo<double>::func<int>', 'loc_names': ['auto ns::Foo<double>::func<int>()']}, {'name': 'func', 'loc_names': ['auto ns::Foo<double>::func<int>()', 'auto ns::Foo<double>::func<ns::Foo<int>>()']}, @@ -71,6 +84,15 @@ {'name': 'operator<<<int>', 'loc_names': ['void ns::Foo<double>::operator<<<int>(int)']}, {'name': 'ns::Foo<double>::operator<<', 'loc_names': ['void ns::Foo<double>::operator<<<int>(int)', 'void ns::Foo<double>::operator<<<ns::Foo<int>>(ns::Foo<int>)']}, + + {'name': 'g<float>', 'loc_names': []}, + {'name': 'g<int>', 'loc_names': ['void ns::g<int>()']}, + {'name': 'g<char>', 'loc_names': ['void ns::g<char>()']}, + {'name': 'g', 'loc_names': ['void ns::g<int>()', 'void ns::g<char>()']}, + {'name': 'ns::g<float>', 'loc_names': []}, + {'name': 'ns::g<int>', 'loc_names': ['void ns::g<int>()']}, + {'name': 'ns::g<char>', 'loc_names': ['void ns::g<char>()']}, + {'name': 'ns::g', 'loc_names': ['void ns::g<int>()', 'void ns::g<char>()']}, ] for bp_dict in bp_dicts: Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2389,6 +2389,24 @@ ResolveFunction(die, include_inlines, sc_list); return true; }); + // With -gsimple-template-names, a templated type's DW_AT_name will not + // contain the template parameters. Try again stripping '<' and anything + // after, filtering out entries with template parameters that don't match. + { + const llvm::StringRef name_ref = name.GetStringRef(); + auto it = name_ref.find('<'); + if (it != llvm::StringRef::npos) { + const llvm::StringRef name_no_template_params = name_ref.slice(0, it); + + Module::LookupInfo no_tp_lookup_info(lookup_info); + no_tp_lookup_info.SetLookupName(ConstString(name_no_template_params)); + m_index->GetFunctions(no_tp_lookup_info, *this, parent_decl_ctx, [&](DWARFDIE die) { + if (resolved_dies.insert(die.GetDIE()).second) + ResolveFunction(die, include_inlines, sc_list); + return true; + }); + } + } // Return the number of variable that were appended to the list const uint32_t num_matches = sc_list.GetSize() - original_size;
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits