xref: /llvm-project/clang/test/APINotes/types.m (revision 694fd1f297feaf59cd29a3d17e63ee2f6514dd16)
1// RUN: rm -rf %t && mkdir -p %t
2// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache -fapinotes-modules -Wno-private-module -fdisable-module-hash -fsyntax-only -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s -verify
3// RUN: %clang_cc1 -ast-print %t/ModulesCache/SimpleKit.pcm | FileCheck %s
4
5#import <SomeKit/SomeKit.h>
6#import <SimpleKit/SimpleKit.h>
7
8// CHECK: struct __attribute__((swift_name("SuccessfullyRenamedA"))) RenamedAgainInAPINotesA {
9// CHECK: struct __attribute__((swift_name("SuccessfullyRenamedB"))) RenamedAgainInAPINotesB {
10// CHECK: typedef enum __attribute__((swift_name("SuccessfullyRenamedC"))) {
11// CHECK-NEXT: kConstantInAnonEnum
12// CHECK-NEXT: } AnonEnumWithTypedefName
13
14void test(OverriddenTypes *overridden) {
15  int *ip1 = global_int_ptr; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'double (*)(int, int)'}}
16
17  int *ip2 = global_int_fun( // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'char *'}}
18               ip2, // expected-warning{{incompatible pointer types passing 'int *' to parameter of type 'double *'}}
19               ip2); // expected-warning{{incompatible pointer types passing 'int *' to parameter of type 'float *'}}
20
21  int *ip3 = [overridden // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'char *'}}
22                methodToMangle: ip3 // expected-warning{{incompatible pointer types sending 'int *' to parameter of type 'double *'}}
23                        second: ip3]; // expected-warning{{incompatible pointer types sending 'int *' to parameter of type 'float *'}}
24
25  int *ip4 = overridden.intPropertyToMangle; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'double *'}}
26}
27
28// expected-note@SomeKit/SomeKit.h:42{{passing argument to parameter 'ptr' here}}
29// expected-note@SomeKit/SomeKit.h:42{{passing argument to parameter 'ptr2' here}}
30// expected-note@SomeKit/SomeKit.h:48{{passing argument to parameter 'ptr1' here}}
31// expected-note@SomeKit/SomeKit.h:48{{passing argument to parameter 'ptr2' here}}
32