xref: /llvm-project/clang/test/Modules/method_pool_transitive.m (revision 0a35cc40b881a35c6a7a748f5fdefac4cafc33ce)
1// RUN: rm -rf %t
2// RUN: split-file %s %t
3// RUN: %clang_cc1 -Wobjc-multiple-method-names -fsyntax-only -fmodules-cache-path=%t/modules.cache -fmodules -fimplicit-module-maps -F %t/Frameworks %t/test.m -verify
4
5// Verify we are handling methods from transitive modules, not just from immediate ones.
6
7//--- Frameworks/Indirect.framework/Headers/Indirect.h
8@interface NSObject
9@end
10
11@interface Indirect : NSObject
12- (int)method;
13@end
14
15//--- Frameworks/Indirect.framework/Modules/module.modulemap
16framework module Indirect {
17  header "Indirect.h"
18  export *
19}
20
21//--- Frameworks/Immediate.framework/Headers/Immediate.h
22#import <Indirect/Indirect.h>
23@interface Immediate : NSObject
24- (void)method;
25@end
26
27//--- Frameworks/Immediate.framework/Modules/module.modulemap
28framework module Immediate {
29  header "Immediate.h"
30  export *
31}
32
33//--- test.m
34#import <Immediate/Immediate.h>
35
36void test(id obj) {
37  [obj method];  // expected-warning{{multiple methods named 'method' found}}
38  // expected-note@Frameworks/Indirect.framework/Headers/Indirect.h:5{{using}}
39  // expected-note@Frameworks/Immediate.framework/Headers/Immediate.h:3{{also found}}
40}
41