brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 5e63e60 Raw
79 lines · c
1// If secondary output files such as .d are enabled, ensure it affects the2// module context hash since it may impact the resulting module 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:              "-dependency-file"17// CHECK:            ]18// CHECK:            "context-hash": "[[HASH1:.*]]"19// CHECK:            "name": "Mod"20// CHECK-NEXT:     }21// CHECK-NEXT:     {22// CHECK:            "command-line": [23// CHECK-NOT:          "-dependency-file"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:              "-dependency-file"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:          "-MF"51// CHECK-NOT:          "-dependency-file"52// CHECK:            ]53// CHECK:            "input-file": "{{.*}}tu2.c"54 55//--- cdb.json.template56[57  {58    "directory": "DIR",59    "command": "clang -MD -MF DIR/tu1.d -fsyntax-only DIR/tu1.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",60    "file": "DIR/tu1.c"61  },62  {63    "directory": "DIR",64    "command": "clang -fsyntax-only DIR/tu2.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",65    "file": "DIR/tu2.c"66  },67]68 69//--- module.modulemap70module Mod { header "Mod.h" }71 72//--- Mod.h73 74//--- tu1.c75#include "Mod.h"76 77//--- tu2.c78#include "Mod.h"79