1 // UNSUPPORTED: target={{.*}}-aix{{.*}}
3 // RUN: split-file %s %t
4 // RUN: %clang_cc1 -fsyntax-only -I%t/include %t/test.m \
5 // RUN: -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache -fmodule-name=CheckOverride
7 // Test that if we have the same method in a different module, it's not an
8 // override as it is the same method and it has the same DeclContext but a
9 // different object in the memory.
12 //--- include/CheckOverride.h
16 @interface CheckOverrideInterfaceOnly: NSObject
17 - (void)potentialOverrideInterfaceOnly;
20 @interface CheckOverrideCategoryOnly: NSObject
22 @interface CheckOverrideCategoryOnly(CategoryOnly)
23 - (void)potentialOverrideCategoryOnly;
26 @interface CheckOverrideImplementationOfInterface: NSObject
27 - (void)potentialOverrideImplementationOfInterface;
30 @interface CheckOverrideImplementationOfCategory: NSObject
32 @interface CheckOverrideImplementationOfCategory(CategoryImpl)
33 - (void)potentialOverrideImplementationOfCategory;
36 //--- include/Redirect.h
37 // Ensure CheckOverride is imported as the module despite all `-fmodule-name` flags.
38 #import <CheckOverride.h>
40 //--- include/module.modulemap
41 module CheckOverride {
42 header "CheckOverride.h"
50 #import <CheckOverride.h>
53 @implementation CheckOverrideImplementationOfInterface
54 - (void)potentialOverrideImplementationOfInterface {}
57 @implementation CheckOverrideImplementationOfCategory
58 - (void)potentialOverrideImplementationOfCategory {}
61 void triggerOverrideCheck(CheckOverrideInterfaceOnly *intfOnly,
62 CheckOverrideCategoryOnly *catOnly,
63 CheckOverrideImplementationOfInterface *intfImpl,
64 CheckOverrideImplementationOfCategory *catImpl) {
65 [intfOnly potentialOverrideInterfaceOnly];
66 [catOnly potentialOverrideCategoryOnly];
67 [intfImpl potentialOverrideImplementationOfInterface];
68 [catImpl potentialOverrideImplementationOfCategory];