78 lines · c
1// Differences in -W warning options should result in different canonical module2// build commands.3 4// RUN: rm -rf %t5// RUN: split-file %s %t6// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json7 8// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 \9// RUN: -format experimental-full > %t/deps.json10// RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s11 12// CHECK: {13// CHECK-NEXT: "modules": [14// CHECK: {15// CHECK: "command-line": [16// CHECK: "-Wall"17// CHECK: ]18// CHECK: "context-hash": "[[HASH1:.*]]"19// CHECK: "name": "Mod"20// CHECK-NEXT: }21// CHECK-NEXT: {22// CHECK: "command-line": [23// CHECK-NOT: "-Wall"24// CHECK: ]25// CHECK: "context-hash": "[[HASH2:.*]]"26// CHECK: "name": "Mod"27// CHECK-NEXT: }28// CHECK-NEXT: ]29// CHECK-NEXT: "translation-units": [30// CHECK-NEXT: {31// CHECK: "clang-module-deps": [32// CHECK-NEXT: {33// CHECK-NEXT: "context-hash": "[[HASH1]]"34// CHECK-NEXT: "module-name": "Mod"35// CHECK-NEXT: }36// CHECK-NEXT: ]37// CHECK-NEXT: "command-line": [38// CHECK: "-Wall"39// CHECK: ]40// CHECK: "input-file": "{{.*}}tu1.c"41// CHECK-NEXT: }42// CHECK: {43// CHECK: "clang-module-deps": [44// CHECK-NEXT: {45// CHECK-NEXT: "context-hash": "[[HASH2]]"46// CHECK-NEXT: "module-name": "Mod"47// CHECK-NEXT: }48// CHECK-NEXT: ]49// CHECK-NEXT: "command-line": [50// CHECK-NOT: "-Wall"51// CHECK: ]52// CHECK: "input-file": "{{.*}}tu2.c"53 54//--- cdb.json.template55[56 {57 "directory": "DIR",58 "command": "clang -Wall -fsyntax-only DIR/tu1.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",59 "file": "DIR/tu1.c"60 },61 {62 "directory": "DIR",63 "command": "clang -fsyntax-only DIR/tu2.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",64 "file": "DIR/tu2.c"65 },66]67 68//--- module.modulemap69module Mod { header "Mod.h" }70 71//--- Mod.h72 73//--- tu1.c74#include "Mod.h"75 76//--- tu2.c77#include "Mod.h"78