[lldb][NFC] Actually test which method we call in TestCallOverriddenMethod

llvm-svn: 373051
This commit is contained in:
Raphael Isemann 2019-09-27 08:21:08 +00:00
parent c4488a6e9d
commit a8d04651ce
2 changed files with 8 additions and 4 deletions

View File

@ -40,9 +40,12 @@ class ExprCommandCallOverriddenMethod(TestBase):
# Test call to method in base class (this should always work as the base
# class method is never an override).
self.expect("expr b->foo()")
self.expect("expr b->foo()", substrs=["2"])
# Test call to overridden method in derived class (this will fail if the
# overrides table is not correctly set up, as Derived::foo will be assigned
# a vtable entry that does not exist in the compiled program).
self.expect("expr d.foo()")
self.expect("expr d.foo()", substrs=["2"])
# Test calling the base class.
self.expect("expr realbase.foo()", substrs=["1"])

View File

@ -1,15 +1,16 @@
class Base {
public:
virtual ~Base() {}
virtual void foo() {}
virtual int foo() { return 1; }
};
class Derived : public Base {
public:
virtual void foo() {}
virtual int foo() { return 2; }
};
int main() {
Base realbase;
Derived d;
Base *b = &d;
return 0; // Set breakpoint here