forked from OSchip/llvm-project
[lldb][NFC] Actually test which method we call in TestCallOverriddenMethod
llvm-svn: 373051
This commit is contained in:
parent
c4488a6e9d
commit
a8d04651ce
|
@ -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"])
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue