@@ -2868,47 +2868,25 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
2868
2868
: public SILVTableVisitor<VerifyClassMethodVisitor>
2869
2869
{
2870
2870
public:
2871
- SILDeclRef MethodToSee ;
2871
+ SILDeclRef Method ;
2872
2872
bool Seen = false ;
2873
-
2874
- VerifyClassMethodVisitor (ClassDecl *theClass,
2875
- SILDeclRef method)
2876
- : MethodToSee(method)
2877
- {
2873
+
2874
+ VerifyClassMethodVisitor (SILDeclRef method)
2875
+ : Method(method.getOverriddenVTableEntry()) {
2876
+ auto *theClass = cast<ClassDecl>(Method.getDecl ()->getDeclContext ());
2878
2877
addVTableEntries (theClass);
2879
2878
}
2880
-
2881
- bool methodMatches (SILDeclRef method) {
2882
- auto methodToCheck = MethodToSee;
2883
- do {
2884
- if (method == methodToCheck) {
2885
- return true ;
2886
- }
2887
- } while ((methodToCheck = methodToCheck.getNextOverriddenVTableEntry ()));
2888
2879
2889
- return false ;
2890
- }
2891
-
2892
2880
void addMethod (SILDeclRef method) {
2893
2881
if (Seen)
2894
2882
return ;
2895
- if (methodMatches (method))
2896
- Seen = true ;
2897
- }
2898
-
2899
- void addMethodOverride (SILDeclRef base, SILDeclRef derived) {
2900
- if (Seen)
2901
- return ;
2902
- // The derived method should already have been checked.
2903
- // Test against the overridden base.
2904
- if (methodMatches (base))
2883
+ if (method == Method)
2905
2884
Seen = true ;
2906
2885
}
2907
2886
2908
-
2909
- void addPlaceholder (MissingMemberDecl *) {
2910
- /* no-op */
2911
- }
2887
+ void addMethodOverride (SILDeclRef base, SILDeclRef derived) {}
2888
+
2889
+ void addPlaceholder (MissingMemberDecl *) {}
2912
2890
};
2913
2891
2914
2892
void checkClassMethodInst (ClassMethodInst *CMI) {
@@ -2935,10 +2913,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
2935
2913
" extension method cannot be dispatched natively" );
2936
2914
2937
2915
// The method ought to appear in the class vtable.
2938
- require (VerifyClassMethodVisitor (
2939
- operandType.getASTType ()->getMetatypeInstanceType ()
2940
- ->getClassOrBoundGenericClass (),
2941
- member).Seen ,
2916
+ require (VerifyClassMethodVisitor (member).Seen ,
2942
2917
" method does not appear in the class's vtable" );
2943
2918
}
2944
2919
@@ -2972,10 +2947,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
2972
2947
" super_method must look up a class method" );
2973
2948
2974
2949
// The method ought to appear in the class vtable.
2975
- require (VerifyClassMethodVisitor (
2976
- operandType.getASTType ()->getMetatypeInstanceType ()
2977
- ->getClassOrBoundGenericClass (),
2978
- member).Seen ,
2950
+ require (VerifyClassMethodVisitor (member).Seen ,
2979
2951
" method does not appear in the class's vtable" );
2980
2952
}
2981
2953
0 commit comments