1f33173acSJan Svoboda// This test checks that we don't report non-affecting system module maps. 2f33173acSJan Svoboda// More specifically, we check that explicitly-specified module map file is not 3f33173acSJan Svoboda// being shadowed in explicit build by a module map file found during implicit 4f33173acSJan Svoboda// module map search. 5f33173acSJan Svoboda 6f33173acSJan Svoboda// RUN: rm -rf %t 7f33173acSJan Svoboda// RUN: split-file %s %t 8f33173acSJan Svoboda 9f33173acSJan Svoboda//--- tu.m 10f33173acSJan Svoboda@import first; 11f33173acSJan Svoboda 12f33173acSJan Svoboda//--- zeroth/module.modulemap 13f33173acSJan Svobodamodule X {} 14f33173acSJan Svoboda 15f33173acSJan Svoboda//--- first/module.modulemap 16f33173acSJan Svobodamodule first { header "first.h" } 17f33173acSJan Svoboda//--- first/first.h 18f33173acSJan Svoboda@import third; 19f33173acSJan Svoboda//--- second/module.modulemap 20f33173acSJan Svobodamodule X {} 21f33173acSJan Svoboda//--- third/module.modulemap 22f33173acSJan Svobodamodule third {} 23f33173acSJan Svoboda 24f33173acSJan Svoboda//--- cdb.json.template 25f33173acSJan Svoboda[{ 26f33173acSJan Svoboda "file": "DIR/tu.m", 27f33173acSJan Svoboda "directory": "DIR", 28f33173acSJan Svoboda "command": "clang -fmodules -fmodules-cache-path=DIR/cache -fmodule-name=X -fmodule-map-file=DIR/zeroth/module.modulemap -isystem DIR/first -isystem DIR/second -isystem DIR/third -c DIR/tu.m -o DIR/tu.o" 29f33173acSJan Svoboda}] 30f33173acSJan Svoboda 31f33173acSJan Svoboda// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json 32f33173acSJan Svoboda// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json 33f33173acSJan Svoboda// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t 34f33173acSJan Svoboda// CHECK: { 35f33173acSJan Svoboda// CHECK-NEXT: "modules": [ 36f33173acSJan Svoboda// CHECK-NEXT: { 37f33173acSJan Svoboda// CHECK-NEXT: "clang-module-deps": [ 38f33173acSJan Svoboda// CHECK-NEXT: { 39f33173acSJan Svoboda// CHECK-NEXT: "context-hash": "{{.*}}", 40f33173acSJan Svoboda// CHECK-NEXT: "module-name": "third" 41f33173acSJan Svoboda// CHECK-NEXT: } 42f33173acSJan Svoboda// CHECK-NEXT: ], 43f33173acSJan Svoboda// CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/first/module.modulemap", 44f33173acSJan Svoboda// CHECK-NEXT: "command-line": [ 45f33173acSJan Svoboda// CHECK: ], 46f33173acSJan Svoboda// CHECK-NEXT: "context-hash": "{{.*}}", 47f33173acSJan Svoboda// CHECK-NEXT: "file-deps": [ 48f33173acSJan Svoboda// CHECK-NEXT: [[PREFIX]]/first/module.modulemap", 49*9d4837f4SJan Svoboda// CHECK-NEXT: [[PREFIX]]/first/first.h", 50f33173acSJan Svoboda// CHECK-NEXT: [[PREFIX]]/third/module.modulemap" 51f33173acSJan Svoboda// CHECK-NEXT: ], 5268eb3b20SArtem Chikin// CHECK-NEXT: "link-libraries": [], 53f33173acSJan Svoboda// CHECK-NEXT: "name": "first" 54f33173acSJan Svoboda// CHECK-NEXT: } 55f33173acSJan Svoboda// CHECK: ] 56f33173acSJan Svoboda// CHECK: } 57f33173acSJan Svoboda 58f33173acSJan Svoboda// RUN: %deps-to-rsp %t/result.json --module-name=third > %t/third.cc1.rsp 59f33173acSJan Svoboda// RUN: %deps-to-rsp %t/result.json --module-name=first > %t/first.cc1.rsp 60f33173acSJan Svoboda// RUN: %clang @%t/third.cc1.rsp 61f33173acSJan Svoboda// RUN: %clang @%t/first.cc1.rsp 62