brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 150112d Raw
78 lines · c
1// Ensure the path to the modulemap input is included in the module context hash2// irrespective of other TU command-line arguments, as it effects the canonical3// module build command. In this test we use the difference in spelling between4// module.modulemap and module.map, but it also applies to situations such as5// differences in case-insensitive paths if they are not canonicalized away.6 7// RUN: rm -rf %t8// RUN: split-file %s %t9// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json10 11// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 \12// RUN:   -format experimental-full > %t/deps.json13 14// RUN: mv %t/module.modulemap %t/module.map15// RUN: echo 'AFTER_MOVE' >> %t/deps.json16 17// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 \18// RUN:   -format experimental-full >> %t/deps.json19 20// RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s21 22// CHECK:      {23// CHECK-NEXT:   "modules": [24// CHECK:          {25// CHECK:            "command-line": [26// CHECK:              "{{.*}}module.modulemap"27// CHECK:            ]28// CHECK:            "context-hash": "[[HASH1:.*]]"29// CHECK:            "name": "Mod"30// CHECK-NEXT:     }31// CHECK-NEXT:   ]32// CHECK-NEXT:   "translation-units": [33// CHECK-NEXT:     {34// CHECK:            "clang-module-deps": [35// CHECK-NEXT:         {36// CHECK-NEXT:           "context-hash": "[[HASH1]]"37// CHECK-NEXT:            "module-name": "Mod"38// CHECK-NEXT:         }39// CHECK-NEXT:       ]40// CHECK-LABEL: AFTER_MOVE41// CHECK:      {42// CHECK-NEXT:   "modules": [43// CHECK:          {44// CHECK-NOT: [[HASH1]]45// CHECK:            "command-line": [46// CHECK:              "{{.*}}module.map"47// CHECK:            ]48// CHECK-NOT: [[HASH1]]49// CHECK:            "name": "Mod"50// CHECK-NEXT:     }51// CHECK-NEXT:   ]52// CHECK-NEXT:   "translation-units": [53// CHECK-NEXT:     {54// CHECK:            "clang-module-deps": [55// CHECK-NEXT:         {56// CHECK-NEXT:           "context-hash":57// CHECK-NOT: [[HASH1]]58// CHECK-NEXT:            "module-name": "Mod"59// CHECK-NEXT:         }60// CHECK-NEXT:       ]61 62//--- cdb.json.template63[64  {65    "directory": "DIR",66    "command": "clang -fsyntax-only DIR/tu.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",67    "file": "DIR/tu.c"68  }69]70 71//--- module.modulemap72module Mod { header "Mod.h" }73 74//--- Mod.h75 76//--- tu.c77#include "Mod.h"78