[lldb][Breakpoint] Fix setting breakpoints on templates by basename
authorMichael Buch <michaelbuch12@gmail.com>
Thu, 13 Oct 2022 21:20:23 +0000 (22:20 +0100)
committerMichael Buch <michaelbuch12@gmail.com>
Fri, 14 Oct 2022 22:51:00 +0000 (23:51 +0100)
commitd4a55ad346514b2478762cbc198942c72347e81e
tree9f7851577711045ec28ab8067de8644c92d7207a
parentc116bd9f607a0fb744ba411f7b06848bd61e4427
[lldb][Breakpoint] Fix setting breakpoints on templates by basename

This patch fixes a regression with setting breakpoints on template
functions by name. E.g.,:
```
$ cat main.cpp
template<typename T>
struct Foo {
  template<typename U>
  void func() {}
};

int main() {
  Foo<int> f;
  f.func<double>();
}

(lldb) br se -n func
```

This has regressed since `3339000e0bda696c2e29173d15958c0a4978a143`
where we started using the `CPlusPlusNameParser` for getting the
basename of the function symbol and match it exactly against
the name in the breakpoint command. The parser will include template
parameters in the basename, so the exact match will always fail

**Testing**

* Added API tests
* Added unit-tests

Differential Revision: https://reviews.llvm.org/D135921
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
lldb/test/API/functionalities/breakpoint/cpp/Makefile
lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
lldb/test/API/functionalities/breakpoint/cpp/main.cpp
lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp