1 /** 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef PANDA_RUNTIME_VTABLE_BUILDER_VARIANCE_H 16 #define PANDA_RUNTIME_VTABLE_BUILDER_VARIANCE_H 17 18 #include "runtime/include/vtable_builder_base.h" 19 20 namespace ark { 21 22 template <class ProtoCompatibility, class OverridePred> 23 class VarianceVTableBuilder final : public VTableBuilderBase<false> { 24 public: VarianceVTableBuilder(ClassLinkerErrorHandler * errHandler)25 explicit VarianceVTableBuilder(ClassLinkerErrorHandler *errHandler) : VTableBuilderBase(errHandler) {} 26 27 private: 28 [[nodiscard]] bool ProcessClassMethod(const MethodInfo *info) override; 29 [[nodiscard]] bool ProcessDefaultMethod(ITable itable, size_t itableIdx, MethodInfo *methodInfo) override; 30 31 std::optional<MethodInfo const *> ScanConflictingDefaultMethods(const MethodInfo *info); 32 33 static bool IsOverriddenBy(Method::ProtoId const &base, Method::ProtoId const &derv); 34 35 static bool IsOverriddenOrOverrides(Method::ProtoId const &p1, Method::ProtoId const &p2); 36 }; 37 38 } // namespace ark 39 40 #endif // PANDA_RUNTIME_VTABLE_BUILDER_VARIANCE_H 41