blob: ccf3aab3d0faf4a6ef9271a6f7654b624eccec9c [file] [log] [blame]
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -07001// RUN: rm -rf %t
2// RUN: cd %S
3//
4// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
5// RUN: -iquote Inputs/merge-target-features \
6// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
7// RUN: -fmodule-map-file-home-is-cwd \
8// RUN: -emit-module -fmodule-name=foo -o %t/foo.pcm \
9// RUN: -triple i386-unknown-unknown \
10// RUN: -target-cpu i386 -target-feature +sse2 \
11// RUN: Inputs/merge-target-features/module.modulemap
12//
13// RUN: not %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
14// RUN: -iquote Inputs/merge-target-features \
15// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
16// RUN: -fmodule-map-file-home-is-cwd \
17// RUN: -fmodule-map-file=Inputs/merge-target-features/module.modulemap \
18// RUN: -fmodule-file=%t/foo.pcm \
19// RUN: -triple i386-unknown-unknown \
20// RUN: -target-cpu i386 \
21// RUN: -fsyntax-only merge-target-features.cpp 2>&1 \
22// RUN: | FileCheck --check-prefix=SUBSET %s
23// SUBSET: AST file was compiled with the target feature'+sse2' but the current translation unit is not
24//
25// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
26// RUN: -iquote Inputs/merge-target-features \
27// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
28// RUN: -fmodule-map-file-home-is-cwd \
29// RUN: -fmodule-map-file=Inputs/merge-target-features/module.modulemap \
30// RUN: -fmodule-file=%t/foo.pcm \
31// RUN: -triple i386-unknown-unknown \
32// RUN: -target-cpu i386 -target-feature +sse2 \
33// RUN: -fsyntax-only merge-target-features.cpp 2>&1 \
34// RUN: | FileCheck --allow-empty --check-prefix=SAME %s
35// SAME-NOT: error:
36//
37// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
38// RUN: -iquote Inputs/merge-target-features \
39// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
40// RUN: -fmodule-map-file-home-is-cwd \
41// RUN: -fmodule-map-file=Inputs/merge-target-features/module.modulemap \
42// RUN: -fmodule-file=%t/foo.pcm \
43// RUN: -triple i386-unknown-unknown \
44// RUN: -target-cpu i386 -target-feature +sse2 -target-feature +sse3 \
45// RUN: -fsyntax-only merge-target-features.cpp 2>&1 \
46// RUN: | FileCheck --allow-empty --check-prefix=SUPERSET %s
47// SUPERSET-NOT: error:
48//
49// RUN: not %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
50// RUN: -iquote Inputs/merge-target-features \
51// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
52// RUN: -fmodule-map-file-home-is-cwd \
53// RUN: -fmodule-map-file=Inputs/merge-target-features/module.modulemap \
54// RUN: -fmodule-file=%t/foo.pcm \
55// RUN: -triple i386-unknown-unknown \
56// RUN: -target-cpu i386 -target-feature +cx16 \
57// RUN: -fsyntax-only merge-target-features.cpp 2>&1 \
58// RUN: | FileCheck --check-prefix=MISMATCH %s
59// MISMATCH: AST file was compiled with the target feature'+sse2' but the current translation unit is not
60// MISMATCH: current translation unit was compiled with the target feature'+cx16' but the AST file was not
61
62#include "foo.h"
63
64int test(int x) {
65 return foo(x);
66}