summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-08-28 13:33:52 +0000
committerRaphael Isemann <teemperor@gmail.com>2019-08-28 13:33:52 +0000
commit4046e1ee21a86a8ecdcf5edf5d23b7eb8bd977fb (patch)
tree177b8a52a539a8e20d0537dcb07e8211bd0cce04 /lldb/packages/Python/lldbsuite/test
parentaba62e9c00e5ada889438aa19dfb4b13e9870044 (diff)
downloadbcm5719-llvm-4046e1ee21a86a8ecdcf5edf5d23b7eb8bd977fb.tar.gz
bcm5719-llvm-4046e1ee21a86a8ecdcf5edf5d23b7eb8bd977fb.zip
[lldb][NFC] Test named operators like new and function names that might confuse LLDB
llvm-svn: 370199
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/operators/main.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/operators/main.cpp b/lldb/packages/Python/lldbsuite/test/lang/cpp/operators/main.cpp
index c909d1337be..e531ddaf738 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/operators/main.cpp
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/operators/main.cpp
@@ -1,5 +1,10 @@
+#include <cstdlib>
+
struct B { int dummy = 2324; };
struct C {
+ void *operator new(size_t size) { C* r = ::new C; r->custom_new = true; return r; }
+
+ bool custom_new = false;
B b;
B* operator->() { return &b; }
int operator->*(int) { return 2; }
@@ -48,6 +53,11 @@ struct C {
operator int() { return 11; }
operator long() { return 12; }
+
+ // Make sure this doesn't collide with
+ // the real operator int.
+ int operatorint() { return 13; }
+ int operatornew() { return 14; }
};
int main(int argc, char **argv) {
@@ -99,6 +109,10 @@ int main(int argc, char **argv) {
result += static_cast<int>(c);
result += static_cast<long>(c);
+ result += c.operatorint();
+ result += c.operatornew();
+
+ C *c2 = new C();
//% self.expect("expr c->dummy", endstr=" 2324\n")
//% self.expect("expr c->*2", endstr=" 2\n")
@@ -141,5 +155,9 @@ int main(int argc, char **argv) {
//% self.expect("expr c[1]", endstr=" 92\n")
//% self.expect("expr static_cast<int>(c)", endstr=" 11\n")
//% self.expect("expr static_cast<long>(c)", endstr=" 12\n")
+ //% self.expect("expr c.operatorint()", endstr=" 13\n")
+ //% self.expect("expr c.operatornew()", endstr=" 14\n")
+ //% self.expect("expr (new C)->custom_new", endstr=" true\n")
+ delete c2;
return 0;
}
OpenPOWER on IntegriCloud