[clang][Driver] Support simplified triple versions for config files (#111387)
[llvm-project.git] / clang / test / Modules / implicit-built-Werror-using-W.cpp
blob973dbba130b7f6edcca66ecb7059e97828b2a7b6
1 // Check that implicit modules builds give correct diagnostics, even when
2 // reusing a module built with strong -Werror flags.
3 //
4 // Clear the caches.
5 // RUN: rm -rf %t.cache %t-pragma.cache
6 //
7 // Build with -Werror, then with -W, and then with neither.
8 // RUN: not %clang_cc1 -triple x86_64-apple-darwin16 -fsyntax-only -fmodules \
9 // RUN: -Werror=shorten-64-to-32 \
10 // RUN: -I%S/Inputs/implicit-built-Werror-using-W -fimplicit-module-maps \
11 // RUN: -fmodules-cache-path=%t.cache -x c++ %s 2>&1 \
12 // RUN: | FileCheck %s -check-prefix=CHECK-ERROR
13 // RUN: %clang_cc1 -triple x86_64-apple-darwin16 -fsyntax-only -fmodules \
14 // RUN: -Wshorten-64-to-32 \
15 // RUN: -I%S/Inputs/implicit-built-Werror-using-W -fimplicit-module-maps \
16 // RUN: -fdisable-module-hash \
17 // RUN: -fmodules-cache-path=%t.cache -x c++ %s 2>&1 \
18 // RUN: | FileCheck %s -check-prefix=CHECK-WARN
19 // RUN: %clang_cc1 -triple x86_64-apple-darwin16 -fsyntax-only -fmodules \
20 // RUN: -I%S/Inputs/implicit-built-Werror-using-W -fimplicit-module-maps \
21 // RUN: -fmodules-cache-path=%t.cache -x c++ %s 2>&1 \
22 // RUN: | FileCheck %s -allow-empty
24 // In the presence of a warning pragma, build with -Werror and then without.
25 // RUN: %clang_cc1 -triple x86_64-apple-darwin16 -fsyntax-only -fmodules \
26 // RUN: -DUSE_PRAGMA=1 -Werror=shorten-64-to-32 \
27 // RUN: -I%S/Inputs/implicit-built-Werror-using-W -fimplicit-module-maps \
28 // RUN: -fmodules-cache-path=%t-pragma.cache -x c++ %s 2>&1 \
29 // RUN: | FileCheck %s -check-prefix=CHECK-WARN
30 // RUN: %clang_cc1 -triple x86_64-apple-darwin16 -fsyntax-only -fmodules \
31 // RUN: -DUSE_PRAGMA=1 \
32 // RUN: -I%S/Inputs/implicit-built-Werror-using-W -fimplicit-module-maps \
33 // RUN: -fmodules-cache-path=%t-pragma.cache -x c++ %s 2>&1 \
34 // RUN: | FileCheck %s -check-prefix=CHECK-WARN
36 // Test an error pragma.
37 // RUN: not %clang_cc1 -triple x86_64-apple-darwin16 -fsyntax-only -fmodules \
38 // RUN: -DUSE_PRAGMA=2 -Wshorten-64-to-32 \
39 // RUN: -I%S/Inputs/implicit-built-Werror-using-W -fimplicit-module-maps \
40 // RUN: -fmodules-cache-path=%t-pragma.cache -x c++ %s 2>&1 \
41 // RUN: | FileCheck %s -check-prefix=CHECK-ERROR
42 #include <convert.h>
44 long long foo() { return convert<long long>(0); }
46 // CHECK-ERROR: error: implicit conversion
47 // CHECK-WARN: warning: implicit conversion
48 // CHECK-NOT: error: implicit conversion
49 // CHECK-NOT: warning: implicit conversion