brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.9 KiB · 39b2863 Raw
133 lines · c
1/// Most likely platform specific sed differences2// UNSUPPORTED: system-windows3 4/// This test validates that modules that depend on prebuilt modules 5///   resolve `is-in-stable-directories` correctly. 6/// The steps are: 7/// 1. Scan dependencies to build the PCH. One of the module's depend on header 8///   that is seemingly from the sysroot. However, it depends on a local header that is overlaid.9/// 2. Build the PCH & dependency PCMs.10/// 3. Scan a source file that transitively depends on the same modules as the pcm.11 12// RUN: rm -rf %t13// RUN: split-file %s %t14// RUN: sed -e "s|DIR|%/t|g" %t/overlay.json.template > %t/overlay.json15// RUN: sed -e "s|DIR|%/t|g" %t/compile-pch.json.in > %t/compile-pch.json16// RUN: clang-scan-deps -compilation-database %t/compile-pch.json \17// RUN:   -j 1 -format experimental-full > %t/deps_pch.db18// RUN: %clang -x c-header -c %t/prebuild.h -isysroot %t/MacOSX.sdk \19// RUN:   -I%t/BuildDir -ivfsoverlay %t/overlay.json \20// RUN:   -I %t/MacOSX.sdk/usr/include -fmodules -fmodules-cache-path=%t/module-cache \21// RUN:   -fimplicit-module-maps -o %t/prebuild.pch22// RUN: sed -e "s|DIR|%/t|g" %t/compile-commands.json.in > %t/compile-commands.json23// RUN: clang-scan-deps -compilation-database %t/compile-commands.json \24// RUN:   -j 1 -format experimental-full > %t/deps.db25// RUN: cat %t/deps_pch.db | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t --check-prefix PCH_DEP26// RUN: cat %t/deps.db | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t  --check-prefix CLIENT27 28// PCH_DEP: "is-in-stable-directories": true29// PCH_DEP: "name": "A"30 31// PCH_DEP-NOT: "is-in-stable-directories": true32 33// Verify is-in-stable-directories is only assigned to the module that only depends on A.34// CLIENT-NOT: "is-in-stable-directories": true35 36// CLIENT: "name": "D"37// CLIENT: "is-in-stable-directories": true38// CLIENT: "name": "sys"39 40// CLIENT-NOT: "is-in-stable-directories": true41 42//--- compile-pch.json.in43[44{45    "directory": "DIR",46    "command": "clang -x c-header -c DIR/prebuild.h -isysroot DIR/MacOSX.sdk -IDIR/BuildDir -ivfsoverlay DIR/overlay.json -IDIR/MacOSX.sdk/usr/include -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps -o DIR/prebuild.pch",47    "file": "DIR/prebuild.h"48}49]50 51//--- compile-commands.json.in52[53{54    "directory": "DIR",55    "command": "clang -c DIR/client.c -isysroot DIR/MacOSX.sdk -IDIR/BuildDir -ivfsoverlay DIR/overlay.json -IDIR/MacOSX.sdk/usr/include -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps -include-pch DIR/prebuild.pch",56    "file": "DIR/client.c"57}58]59 60//--- overlay.json.template61{62  "version": 0,63  "case-sensitive": "false",64  "roots": [65    {66          "external-contents": "DIR/BuildDir/B_vfs.h",67          "name": "DIR/MacOSX.sdk/usr/include/B/B_vfs.h",68          "type": "file"69    }70  ]71}72 73//--- MacOSX.sdk/usr/include/A/module.modulemap74module A [system] {75  umbrella "."76}77 78//--- MacOSX.sdk/usr/include/A/A.h79typedef int A_type;80 81//--- MacOSX.sdk/usr/include/B/module.modulemap82module B [system] {83  umbrella "."84}85 86//--- MacOSX.sdk/usr/include/B/B.h87#include <B/B_vfs.h>88 89//--- BuildDir/B_vfs.h90typedef int local_t;91 92//--- MacOSX.sdk/usr/include/sys/sys.h93#include <A/A.h>94typedef int sys_t_m;95 96//--- MacOSX.sdk/usr/include/sys/module.modulemap97module sys [system] {98  umbrella "."99}100 101//--- MacOSX.sdk/usr/include/B_transitive/B.h102#include <B/B.h>103 104//--- MacOSX.sdk/usr/include/B_transitive/module.modulemap105module B_transitive [system] {106  umbrella "."107}108 109//--- MacOSX.sdk/usr/include/C/module.modulemap110module C [system] {111  umbrella "."112}113 114//--- MacOSX.sdk/usr/include/C/C.h115#include <B_transitive/B.h>116 117 118//--- MacOSX.sdk/usr/include/D/module.modulemap119module D [system] {120  umbrella "."121}122 123//--- MacOSX.sdk/usr/include/D/D.h124#include <C/C.h>125 126//--- prebuild.h127#include <A/A.h>128#include <C/C.h> // This dependency transitively depends on a local header.129 130//--- client.c131#include <sys/sys.h>132#include <D/D.h> // This dependency transitively depends on a local header.133