1 // Clear and create directories
5 // RUN
: mkdir %t
/Inputs
7 // Build first header file
8 // RUN
: echo
"#define FIRST" >> %t
/Inputs
/first.h
9 // RUN
: cat %s
>> %t
/Inputs
/first.h
11 // Build second header file
12 // RUN
: echo
"#define SECOND" >> %t
/Inputs
/second.h
13 // RUN
: cat %s
>> %t
/Inputs
/second.h
15 // Test that each header can compile
16 // RUN
: %clang_cc1 -fsyntax-only -x c
++ %t
/Inputs
/first.h -cl-std
=CL2.0
17 // RUN
: %clang_cc1 -fsyntax-only -x c
++ %t
/Inputs
/second.h -cl-std
=CL2.0
19 // Build module map file
20 // RUN
: echo
"module FirstModule {" >> %t
/Inputs
/module.modulemap
21 // RUN
: echo
" header \"first.h\"" >> %t
/Inputs
/module.modulemap
22 // RUN
: echo
"}" >> %t
/Inputs
/module.modulemap
23 // RUN
: echo
"module SecondModule {" >> %t
/Inputs
/module.modulemap
24 // RUN
: echo
" header \"second.h\"" >> %t
/Inputs
/module.modulemap
25 // RUN
: echo
"}" >> %t
/Inputs
/module.modulemap
28 // RUN
: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path
=%t
/cache -x c
++ -I%t
/Inputs -verify %s -cl-std
=CL2.0
30 #if
!defined
(FIRST) && !defined
(SECOND)
38 typedef read_only pipe int x
;
41 typedef read_only pipe int x
;
44 typedef read_only pipe int x
;
45 typedef write_only pipe int y
;
46 typedef read_write pipe int z
;
50 typedef write_only pipe int x
;
53 typedef read_only pipe float x
;
56 typedef read_only pipe int x
;
57 typedef write_only pipe int y
;
58 typedef read_write pipe int z
;
63 // expected-error
@second.h
:* {{'invalid1
' has different definitions in different modules
; definition in module 'SecondModule' first difference is function body}}
64 // expected-note
@first.h
:* {{but in
'FirstModule
' found a different body
}}
66 // expected-error
@second.h
:* {{'invalid2
' has different definitions in different modules
; definition in module 'SecondModule' first difference is function body}}
67 // expected-note
@first.h
:* {{but in
'FirstModule
' found a different body
}}
73 // Keep macros contained to one file.