Duncan P. N. Exon Smith | 900f817 | 2017-04-12 03:58:58 +0000 | [diff] [blame] | 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 |
| 23 | // |
| 24 | // In the presence of a warning pragma, build with -Werror and then without. |
| 25 | // RUN: not %clang_cc1 -triple x86_64-apple-darwin16 -fsyntax-only -fmodules \ |
| 26 | // RUN: -DUSE_PRAGMA -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-ERROR |
| 30 | // RUN: %clang_cc1 -triple x86_64-apple-darwin16 -fsyntax-only -fmodules \ |
| 31 | // RUN: -DUSE_PRAGMA \ |
| 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 |
| 35 | #include <convert.h> |
| 36 | |
| 37 | long long foo() { return convert<long long>(0); } |
| 38 | |
| 39 | // CHECK-ERROR: error: implicit conversion |
| 40 | // CHECK-WARN: warning: implicit conversion |
| 41 | // CHECK-NOT: error: implicit conversion |
| 42 | // CHECK-NOT: warning: implicit conversion |