92 lines · plain
1// RUN: rm -rf %t2// RUN: split-file %s %t3 4// Test that different values of `ObjCMethodDecl::isOverriding` in different modules5// 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.m7 8// Test that different values of `ObjCMethodDecl::isPropertyAccessor` in different modules9// 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.m11 12//--- include/Common.h13@interface NSObject14@end15 16//--- include/Indirection.h17#import <Override.h>18#import <PropertyAccessor.h>19 20//--- include/module.modulemap21module Common {22 header "Common.h"23 export *24}25module Indirection {26 header "Indirection.h"27 export *28}29module Override {30 header "Override.h"31 export *32}33module PropertyAccessor {34 header "PropertyAccessor.h"35 export *36}37 38//--- include/Override.h39#import <Common.h>40@interface SubClass: NSObject41- (void)potentialOverride;42@end43 44//--- Override_Internal.h45#import <Common.h>46@interface NSObject(InternalCategory)47- (void)potentialOverride;48@end49 50//--- test-overriding.m51//expected-no-diagnostics52// Get non-modular version of `SubClass`, so that `-[SubClass potentialOverride]`53// is an override of a method in `InternalCategory`.54#import "Override_Internal.h"55#import <Override.h>56 57// Get modular version of `SubClass` where `-[SubClass potentialOverride]` is58// not an override because module "Override" doesn't know about Override_Internal.h.59#import <Indirection.h>60 61void triggerOverrideCheck(SubClass *sc) {62 [sc potentialOverride];63}64 65//--- include/PropertyAccessor.h66#import <Common.h>67@interface PropertySubClass: NSObject68- (int)potentialProperty;69- (void)setPotentialProperty:(int)p;70@end71 72//--- PropertyAccessor_Internal.h73#import <PropertyAccessor.h>74@interface PropertySubClass()75@property int potentialProperty;76@end77 78//--- test-property_accessor.m79//expected-no-diagnostics80// Get a version of `PropertySubClass` where `-[PropertySubClass potentialProperty]`81// is a property accessor.82#import "PropertyAccessor_Internal.h"83 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>87 88void triggerPropertyAccessorCheck(PropertySubClass *x) {89 int tmp = [x potentialProperty];90 [x setPotentialProperty: tmp];91}92