42 lines · c
1// RUN: rm -rf %t && mkdir -p %t2// RUN: split-file %s %t3 4//--- module.modulemap5module Mod { header "mod.h" }6//--- mod.h7//--- tu.c8#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-module14// 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-REBUILD17// 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-module23// 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-empty26// 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-OPTS29// 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-module35// 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-empty38//39// RUN: %clang_cc1 -module-file-info %t/cache3/Mod.pcm | FileCheck %s --check-prefix=OLD-DIAG-OPTS40// OLD-DIAG-OPTS: Diagnostic flags:41// OLD-DIAG-OPTS-NEXT: -Wnon-modular-include-in-module42