2 // RUN: split-file %s %t
4 // Test that different values of `ObjCMethodDecl::isOverriding` in different modules
5 // is not an error because it depends on the surrounding code and not on the method itself.
6 // RUN: %clang_cc1 -fsyntax-only -verify -I%t/include -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache -fmodule-name=Override %t/test-overriding.m
8 // Test that different values of `ObjCMethodDecl::isPropertyAccessor` in different modules
9 // is not an error because it depends on the surrounding code and not on the method itself.
10 // RUN: %clang_cc1 -fsyntax-only -verify -I%t/include -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache -fmodule-name=PropertyAccessor %t/test-property_accessor.m
12 //--- include/Common.h
16 //--- include/Indirection.h
18 #import <PropertyAccessor.h>
20 //--- include/module.modulemap
26 header "Indirection.h"
33 module PropertyAccessor {
34 header "PropertyAccessor.h"
38 //--- include/Override.h
40 @interface SubClass: NSObject
41 - (void)potentialOverride;
44 //--- Override_Internal.h
46 @interface NSObject(InternalCategory)
47 - (void)potentialOverride;
50 //--- test-overriding.m
51 //expected-no-diagnostics
52 // Get non-modular version of `SubClass`, so that `-[SubClass potentialOverride]`
53 // is an override of a method in `InternalCategory`.
54 #import "Override_Internal.h"
57 // Get modular version of `SubClass` where `-[SubClass potentialOverride]` is
58 // not an override because module "Override" doesn't know about Override_Internal.h.
59 #import <Indirection.h>
61 void triggerOverrideCheck(SubClass *sc) {
62 [sc potentialOverride];
65 //--- include/PropertyAccessor.h
67 @interface PropertySubClass: NSObject
68 - (int)potentialProperty;
69 - (void)setPotentialProperty:(int)p;
72 //--- PropertyAccessor_Internal.h
73 #import <PropertyAccessor.h>
74 @interface PropertySubClass()
75 @property int potentialProperty;
78 //--- test-property_accessor.m
79 //expected-no-diagnostics
80 // Get a version of `PropertySubClass` where `-[PropertySubClass potentialProperty]`
81 // is a property accessor.
82 #import "PropertyAccessor_Internal.h"
84 // Get a version of `PropertySubClass` where `-[PropertySubClass potentialProperty]`
85 // is not a property accessor because module "PropertyAccessor" doesn't know about PropertyAccessor_Internal.h.
86 #import <Indirection.h>
88 void triggerPropertyAccessorCheck(PropertySubClass *x) {
89 int tmp = [x potentialProperty];
90 [x setPotentialProperty: tmp];