| 1 |
// RUN: rm -rf %t && mkdir -p %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
|
| 4 |
//--- module.modulemap |
| 5 |
module Mod { header "mod.h" } |
| 6 |
//--- mod.h |
| 7 |
//--- tu.c |
| 8 |
#include "mod.h" |
| 9 |
|
| 10 |
// Without any extra compiler flags, mismatched diagnostic options trigger recompilation of modules. |
| 11 |
// |
| 12 |
// RUN: %clang_cc1 -fmodules -fmodule-map-file=%t/module.modulemap -fmodules-cache-path=%t/cache1 -fdisable-module-hash \ |
| 13 |
// RUN: -fsyntax-only %t/tu.c -Wnon-modular-include-in-module |
| 14 |
// RUN: %clang_cc1 -fmodules -fmodule-map-file=%t/module.modulemap -fmodules-cache-path=%t/cache1 -fdisable-module-hash \ |
| 15 |
// RUN: -fsyntax-only %t/tu.c -Werror=non-modular-include-in-module -Rmodule-build 2>&1 \ |
| 16 |
// RUN: | FileCheck %s --check-prefix=DID-REBUILD |
| 17 |
// DID-REBUILD: remark: building module 'Mod' |
| 18 |
|
| 19 |
// When skipping serialization of diagnostic options, mismatches cannot be detected, old PCM file gets reused. |
| 20 |
// |
| 21 |
// RUN: %clang_cc1 -fmodules -fmodule-map-file=%t/module.modulemap -fmodules-cache-path=%t/cache2 -fdisable-module-hash \ |
| 22 |
// RUN: -fsyntax-only %t/tu.c -fmodules-skip-diagnostic-options -Wnon-modular-include-in-module |
| 23 |
// RUN: %clang_cc1 -fmodules -fmodule-map-file=%t/module.modulemap -fmodules-cache-path=%t/cache2 -fdisable-module-hash \ |
| 24 |
// RUN: -fsyntax-only %t/tu.c -fmodules-skip-diagnostic-options -Werror=non-modular-include-in-module -Rmodule-build 2>&1 \ |
| 25 |
// RUN: | FileCheck %s --check-prefix=DID-REUSE --allow-empty |
| 26 |
// DID-REUSE-NOT: remark: building module 'Mod' |
| 27 |
// |
| 28 |
// RUN: %clang_cc1 -module-file-info %t/cache2/Mod.pcm | FileCheck %s --check-prefix=NO-DIAG-OPTS |
| 29 |
// NO-DIAG-OPTS-NOT: Diagnostic flags: |
| 30 |
|
| 31 |
// When disabling validation of diagnostic options, mismatches are not checked for, old PCM file gets reused. |
| 32 |
// |
| 33 |
// RUN: %clang_cc1 -fmodules -fmodule-map-file=%t/module.modulemap -fmodules-cache-path=%t/cache3 -fdisable-module-hash \ |
| 34 |
// RUN: -fsyntax-only %t/tu.c -fmodules-disable-diagnostic-validation -Wnon-modular-include-in-module |
| 35 |
// RUN: %clang_cc1 -fmodules -fmodule-map-file=%t/module.modulemap -fmodules-cache-path=%t/cache3 -fdisable-module-hash \ |
| 36 |
// RUN: -fsyntax-only %t/tu.c -fmodules-disable-diagnostic-validation -Werror=non-modular-include-in-module -Rmodule-build 2>&1 \ |
| 37 |
// RUN: | FileCheck %s --check-prefix=DID-REUSE --allow-empty |
| 38 |
// |
| 39 |
// RUN: %clang_cc1 -module-file-info %t/cache3/Mod.pcm | FileCheck %s --check-prefix=OLD-DIAG-OPTS |
| 40 |
// OLD-DIAG-OPTS: Diagnostic flags: |
| 41 |
// OLD-DIAG-OPTS-NEXT: -Wnon-modular-include-in-module |