1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 // This file contains a testcase for vtable_dumper. 17 // The compiled shared library should contain vtables for all the classes in 18 // this file. 19 20 class VirtualBase { 21 public: 22 virtual ~VirtualBase() = 0; 23 virtual void foo() = 0; bar()24 virtual void bar() {} baz()25 virtual void baz() {} 26 }; 27 28 class VirtualDerived : public VirtualBase { 29 public: ~VirtualDerived()30 virtual ~VirtualDerived() {} foo()31 virtual void foo() override {} 32 virtual void baz() override = 0; 33 }; 34 35 class ConcreteDerived : public VirtualDerived { 36 public: ~ConcreteDerived()37 virtual ~ConcreteDerived() {} bar()38 virtual void bar() override {} baz()39 virtual void baz() override {} 40 }; 41 42 // This ensures that the vtables are emitted. dummy_init()43void dummy_init() { VirtualBase *base_ptr = new ConcreteDerived(); } 44