63 lines · c
1// This test checks that ordering of TUs in the input CDB is preserved in the full output.2 3// RUN: rm -rf %t4// RUN: split-file %s %t5 6//--- cdb.json.template7[8 {9 "directory": "DIR",10 "file": "DIR/tu.c",11 "command": "clang -fmodules -fmodules-cache-path=DIR/cache -c DIR/tu.c -DONE -o DIR/tu1.o"12 },13 {14 "directory": "DIR",15 "file": "DIR/tu.c",16 "command": "clang -fmodules -fmodules-cache-path=DIR/cache -c DIR/tu.c -DTWO -o DIR/tu2.o"17 }18]19 20//--- tu.c21 22// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json23// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json24// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s25 26// CHECK: {27// CHECK-NEXT: "modules": [],28// CHECK-NEXT: "translation-units": [29// CHECK-NEXT: {30// CHECK-NEXT: "commands": [31// CHECK-NEXT: {32// CHECK-NEXT: "clang-context-hash": "{{.*}}",33// CHECK-NEXT: "clang-module-deps": [],34// CHECK-NEXT: "command-line": [35// CHECK: "-D"36// CHECK-NEXT: "ONE"37// CHECK: ],38// CHECK: "file-deps": [39// CHECK-NEXT: "[[PREFIX]]/tu.c"40// CHECK-NEXT: ],41// CHECK-NEXT: "input-file": "[[PREFIX]]/tu.c"42// CHECK-NEXT: }43// CHECK: ]44// CHECK: },45// CHECK-NEXT: {46// CHECK-NEXT: "commands": [47// CHECK-NEXT: {48// CHECK-NEXT: "clang-context-hash": "{{.*}}",49// CHECK-NEXT: "clang-module-deps": [],50// CHECK-NEXT: "command-line": [51// CHECK: "-D"52// CHECK-NEXT: "TWO"53// CHECK: ],54// CHECK: "file-deps": [55// CHECK-NEXT: "[[PREFIX]]/tu.c"56// CHECK-NEXT: ],57// CHECK-NEXT: "input-file": "[[PREFIX]]/tu.c"58// CHECK: }59// CHECK: ]60// CHECK: }61// CHECK: ]62// CHECK: }63