• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2024-2025 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/class_linker_context.h"
19 #include "runtime/include/vtable_builder_base.h"
20 
21 namespace ark {
22 
23 template <class ProtoCompatibility, class OverridePred>
24 class VarianceVTableBuilder final : public VTableBuilderBase<false> {
25 public:
VarianceVTableBuilder(ClassLinkerErrorHandler * errHandler)26     explicit VarianceVTableBuilder(ClassLinkerErrorHandler *errHandler) : VTableBuilderBase(errHandler) {}
27 
28 private:
29     [[nodiscard]] bool ProcessClassMethod(const MethodInfo *info) override;
30     [[nodiscard]] bool ProcessDefaultMethod(ITable itable, size_t itableIdx, MethodInfo *methodInfo) override;
31 
32     std::optional<MethodInfo const *> ScanConflictingDefaultMethods(const MethodInfo *info);
33 
34     static bool IsOverriddenBy(const ClassLinkerContext *ctx, Method::ProtoId const &base, Method::ProtoId const &derv);
35 
36     static bool IsOverriddenOrOverrides(const ClassLinkerContext *ctx, Method::ProtoId const &p1,
37                                         Method::ProtoId const &p2);
38 };
39 
40 }  // namespace ark
41 
42 #endif  // PANDA_RUNTIME_VTABLE_BUILDER_VARIANCE_H
43