1 // This test verifies that system module variants are mergable despite having
2 // different warning flags, as most warnings are disabled in system modules.
3 // This checks for system modules marked as such both via `-isystem` and
7 // RUN: split-file %s %t
8 // RUN: sed -e "s|DIR|%/t|g" %t/build/compile-commands.json.in > %t/build/compile-commands.json
9 // RUN: clang-scan-deps -compilation-database %t/build/compile-commands.json \
10 // RUN: -j 1 -format experimental-full -optimize-args=system-warnings > %t/deps.db
11 // RUN: cat %t/deps.db | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
14 // CHECK-NEXT: "modules": [
16 // CHECK-NEXT: "clang-module-deps": [],
17 // CHECK-NEXT: "clang-modulemap-file":
18 // CHECK-NEXT: "command-line": [
21 // CHECK-NEXT: "context-hash": "{{.*}}",
22 // CHECK-NEXT: "file-deps": [
24 // CHECK-NEXT: "link-libraries": [],
25 // CHECK-NEXT: "name": "A"
28 // CHECK-NEXT: "clang-module-deps": [],
29 // CHECK-NEXT: "clang-modulemap-file":
30 // CHECK-NEXT: "command-line": [
33 // CHECK-NEXT: "context-hash": "{{.*}}",
34 // CHECK-NEXT: "file-deps": [
36 // CHECK-NEXT: "link-libraries": [],
37 // CHECK-NEXT: "name": "B"
40 // CHECK-NEXT: "clang-module-deps": [],
41 // CHECK-NEXT: "clang-modulemap-file":
42 // CHECK-NEXT: "command-line": [
43 // CHECK: "-Wmaybe-unused
45 // CHECK-NEXT: "context-hash": "{{.*}}",
46 // CHECK-NEXT: "file-deps": [
48 // CHECK-NEXT: "link-libraries": [],
49 // CHECK-NEXT: "name": "C"
52 // CHECK-NEXT: "translation-units": [
56 // A.m and B.m verify that system modules with different warning flags get
57 // merged. C.m verifies that -Wsystem-headers disables the optimization.
58 //--- build/compile-commands.json.in
63 "command": "clang -c DIR/A.m -isystem modules/A -I modules/B -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps",
68 "command": "clang -c DIR/B.m -isystem modules/A -I modules/B -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps -Wmaybe-unused",
73 "command": "clang -c DIR/C.m -isystem modules/C -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps -Wmaybe-unused -Wsystem-headers",
78 //--- modules/A/module.modulemap
88 //--- modules/B/module.modulemap
98 //--- modules/C/module.modulemap
101 umbrella header "C.h"