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++ -std=c++11 %t/Inputs/first.h -fzvector
17 // RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++11 %t/Inputs/second.h -fzvector
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 -std=c++11 -fzvector
30 #if !defined(FIRST) && !defined(SECOND)
39 __attribute((vector_size(8))) int x
;
42 __attribute((vector_size(8))) int x
;
45 __attribute((vector_size(16))) int x
;
48 __attribute((vector_size(8))) int x1
;
49 __attribute((vector_size(16))) int x2
;
50 __attribute((vector_size(8))) unsigned x3
;
51 __attribute((vector_size(16))) long x4
;
57 __attribute((vector_size(16))) int x
;
60 __attribute((vector_size(8))) unsigned x
;
66 __attribute((vector_size(8))) int x1
;
67 __attribute((vector_size(16))) int x2
;
68 __attribute((vector_size(8))) unsigned x3
;
69 __attribute((vector_size(16))) long x4
;
75 // expected-error@second.h:* {{'Types::Vector::Invalid1::x' from module 'SecondModule' is not present in definition of 'Types::Vector::Invalid1' in module 'FirstModule'}}
76 // expected-note@first.h:* {{declaration of 'x' does not match}}
78 // expected-error@second.h:* {{'Types::Vector::Invalid2::x' from module 'SecondModule' is not present in definition of 'Types::Vector::Invalid2' in module 'FirstModule'}}
79 // expected-note@first.h:* {{declaration of 'x' does not match}}
81 // expected-error@second.h:* {{'Types::Vector::Invalid3::x' from module 'SecondModule' is not present in definition of 'Types::Vector::Invalid3' in module 'FirstModule'}}
82 // expected-note@first.h:* {{declaration of 'x' does not match}}
91 } // namespace ExtVector
94 using f
= __attribute__((ext_vector_type(4))) float;
97 using f
= __attribute__((ext_vector_type(8))) float;
101 using f
= __attribute__((ext_vector_type(8))) float;
104 using f
= __attribute__((ext_vector_type(8))) float;
108 // expected-error@first.h:* {{'Types::Invalid::f' from module 'FirstModule' is not present in definition of 'Types::Invalid' in module 'SecondModule'}}
109 // expected-note@second.h:* {{declaration of 'f' does not match}}
117 // Keep macros contained to one file.