1 // Ensure '-DFOO -fmodules-ignore-macro=FOO' and '' both produce the same
2 // canonical module build command.
5 // RUN: split-file %s %t
6 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
8 // RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 \
9 // RUN: -format experimental-full > %t/deps.json
10 // RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s
13 // CHECK-NEXT: "modules": [
15 // CHECK: "command-line": [
17 // CHECK-NOT: "-fmodules-ignore-macro
19 // CHECK: "context-hash": "[[HASH_NO_FOO:.*]]"
20 // CHECK: "name": "Mod"
23 // CHECK: "command-line": [
27 // CHECK: "context-hash": "[[HASH_FOO:.*]]"
28 // CHECK: "name": "Mod"
31 // CHECK-NEXT: "translation-units": [
33 // CHECK: "clang-module-deps": [
35 // CHECK-NEXT: "context-hash": "[[HASH_NO_FOO]]"
36 // CHECK-NEXT: "module-name": "Mod"
39 // CHECK-NEXT: "command-line": [
43 // CHECK: "input-file": "{{.*}}tu1.c"
46 // CHECK: "clang-module-deps": [
48 // CHECK-NEXT: "context-hash": "[[HASH_FOO]]"
49 // CHECK-NEXT: "module-name": "Mod"
52 // CHECK-NEXT: "command-line": [
56 // CHECK: "input-file": "{{.*}}tu2.c"
59 // CHECK: "clang-module-deps": [
61 // CHECK-NEXT: "context-hash": "[[HASH_NO_FOO]]"
62 // CHECK-NEXT: "module-name": "Mod"
65 // CHECK-NEXT: "command-line": [
66 // CHECK: "-fmodules-ignore-macro=FOO"
70 // CHECK: "input-file": "{{.*}}tu3.c"
72 //--- cdb.json.template
76 "command": "clang -fsyntax-only DIR/tu1.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",
81 "command": "clang -DFOO -fsyntax-only DIR/tu2.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",
86 "command": "clang -DFOO -fmodules-ignore-macro=FOO -fsyntax-only DIR/tu3.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",
91 //--- module.modulemap
92 module Mod
{ header
"Mod.h" }