Files
clang-p2996/lldb/test/API/functionalities/breakpoint/cpp/main.cpp
Jim Ingham 3339000e0b We don't require users to type out the full context of a function, for
symbol name matches. Instead, we extract the incoming path's base
name, look up all the symbols with that base name, and then compare
the rest of the context that the user provided to make sure it
matches. However, we do this comparison using just a strstr. So for
instance:

break set -n foo::bar

will match not only "a::foo::bar" but "notherfoo::bar". The former is
pretty clearly the user's intent, but I don't think the latter is, and
results in breakpoints picking up too many matches.

This change adds a Language::DemangledNameContainsPath API which can
do a language aware match against the path provided. If the language
doesn't provide this we fall back to the strstr (though that's changed
to StringRef::contains in the patch).

Differential Revision: https://reviews.llvm.org/D124579
2022-05-12 12:39:28 -07:00

103 lines
1.5 KiB
C++

#include <stdio.h>
#include <stdint.h>
namespace a {
class c {
public:
c();
~c();
void func1()
{
puts (__PRETTY_FUNCTION__);
}
void func2()
{
puts (__PRETTY_FUNCTION__);
}
void func3()
{
puts (__PRETTY_FUNCTION__);
}
};
c::c() {}
c::~c() {}
}
namespace aa {
class cc {
public:
cc();
~cc();
void func1()
{
puts (__PRETTY_FUNCTION__);
}
void func2()
{
puts (__PRETTY_FUNCTION__);
}
void func3()
{
puts (__PRETTY_FUNCTION__);
}
};
cc::cc() {}
cc::~cc() {}
}
namespace b {
class c {
public:
c();
~c();
void func1()
{
puts (__PRETTY_FUNCTION__);
}
void func3()
{
puts (__PRETTY_FUNCTION__);
}
};
c::c() {}
c::~c() {}
}
namespace c {
class d {
public:
d () {}
~d() {}
void func2()
{
puts (__PRETTY_FUNCTION__);
}
void func3()
{
puts (__PRETTY_FUNCTION__);
}
};
}
int main (int argc, char const *argv[])
{
a::c ac;
aa::cc aac;
b::c bc;
c::d cd;
ac.func1();
ac.func2();
ac.func3();
aac.func1();
aac.func2();
aac.func3();
bc.func1();
bc.func3();
cd.func2();
cd.func3();
return 0;
}