1 // This test verifies that command lines with equivalent -D and -U arguments
2 // are canonicalized to the same module variant.
5 // RUN: split-file %s %t
6 // RUN: sed -e "s|DIR|%/t|g" %t/build/compile-commands.json.in > %t/build/compile-commands.json
7 // RUN: clang-scan-deps -compilation-database %t/build/compile-commands.json \
8 // RUN: -j 1 -format experimental-full -optimize-args=canonicalize-macros > %t/deps.db
9 // RUN: cat %t/deps.db | FileCheck %s -DPREFIX=%/t
11 // Verify that there are only two variants and that the expected merges have
15 // CHECK-NEXT: "modules": [
17 // CHECK-NEXT: "clang-module-deps": [],
18 // CHECK-NEXT: "clang-modulemap-file":
19 // CHECK-NEXT: "command-line": [
24 // CHECK-NEXT: "context-hash": "{{.*}}",
25 // CHECK-NEXT: "file-deps": [
27 // CHECK-NEXT: "link-libraries": [],
28 // CHECK-NEXT: "name": "A"
31 // CHECK-NEXT: "clang-module-deps": [],
32 // CHECK-NEXT: "clang-modulemap-file":
33 // CHECK-NEXT: "command-line": [
39 // CHECK-NEXT: "context-hash": "{{.*}}",
40 // CHECK-NEXT: "file-deps": [
42 // CHECK-NEXT: "link-libraries": [],
43 // CHECK-NEXT: "name": "A"
46 // CHECK-NEXT: "translation-units": [
51 //--- build/compile-commands.json.in
56 "command": "clang -c DIR/tu0.m -DJ=1 -UJ -DJ=2 -DI -DK(x)=x -I modules/A -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps",
61 "command": "clang -c DIR/tu1.m -DK -DK(x)=x -DI -D \"J=2\" -I modules/A -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps",
66 "command": "clang -c DIR/tu2.m -I modules/A -DFඞ \"-DF\\\\u{0D9E}\" -DK -DK -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps",
71 //--- modules/A/module.modulemap