Author: Jan Svoboda Date: 2022-03-07T10:47:46+01:00 New Revision: 242b24c1849165bedb73fb14c8012d1d63ffd344
URL: https://github.com/llvm/llvm-project/commit/242b24c1849165bedb73fb14c8012d1d63ffd344 DIFF: https://github.com/llvm/llvm-project/commit/242b24c1849165bedb73fb14c8012d1d63ffd344.diff LOG: [clang][modules] NFC: Simplify and clarify test This patch simplifies a test that checks only used module map files are reported as input files in PCM files. Instead of using opaque `diff`, this patch uses `clang -module-file-info` and `FileCheck` to verify this. Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D120463 Added: Modified: clang/test/Modules/add-remove-irrelevant-module-map.m Removed: clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/b.modulemap ################################################################################ diff --git a/clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap b/clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap deleted file mode 100644 index bf7200f93745b..0000000000000 --- a/clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap +++ /dev/null @@ -1 +0,0 @@ -module a { } diff --git a/clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/b.modulemap b/clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/b.modulemap deleted file mode 100644 index f22b754a9950d..0000000000000 --- a/clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/b.modulemap +++ /dev/null @@ -1 +0,0 @@ -module b { } diff --git a/clang/test/Modules/add-remove-irrelevant-module-map.m b/clang/test/Modules/add-remove-irrelevant-module-map.m index 3341d89e6067b..c7ee07763bbb0 100644 --- a/clang/test/Modules/add-remove-irrelevant-module-map.m +++ b/clang/test/Modules/add-remove-irrelevant-module-map.m @@ -1,16 +1,30 @@ -// RUN: rm -rf %t -// RUN: rm -rf %t.mcp -// RUN: mkdir -p %t +// RUN: rm -rf %t && mkdir %t +// RUN: split-file %s %t -// Build without b.modulemap -// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -fdisable-module-hash -fmodule-map-file=%S/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap %s -verify -// RUN: cp %t.mcp/a.pcm %t/a.pcm +//--- a.modulemap +module a {} -// Build with b.modulemap -// RUN: rm -rf %t.mcp -// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -fdisable-module-hash -fmodule-map-file=%S/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap -fmodule-map-file=%S/Inputs/AddRemoveIrrelevantModuleMap/b.modulemap %s -verify -// RUN: not diff %t.mcp/a.pcm %t/a.pcm +//--- b.modulemap +module b {} +//--- test-simple.m // expected-no-diagnostics - @import a; + +// Build without b.modulemap: +// +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -fdisable-module-hash \ +// RUN: -fmodule-map-file=%t/a.modulemap %t/test-simple.m -verify +// RUN: mv %t/cache %t/cache-without-b + +// Build with b.modulemap: +// +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -fdisable-module-hash \ +// RUN: -fmodule-map-file=%t/a.modulemap -fmodule-map-file=%t/b.modulemap %t/test-simple.m -verify +// RUN: mv %t/cache %t/cache-with-b + +// Neither PCM file considers 'b.modulemap' an input: +// +// RUN: %clang_cc1 -module-file-info %t/cache-without-b/a.pcm | FileCheck %s +// RUN: %clang_cc1 -module-file-info %t/cache-with-b/a.pcm | FileCheck %s +// CHECK-NOT: Input file: {{.*}}/b.modulemap _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits