brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · c0ccdbe Raw
109 lines · plain
1// This test checks that VFS usage doesn't leak between modules.2 3// RUN: rm -rf %t && split-file %s %t4// RUN: sed -e "s|DIR|%/t|g" %t/build/cdb.json.in > %t/build/cdb.json5// RUN: sed -e "s|DIR|%/t|g" %t/build/vfs.yaml.in > %t/build/vfs.yaml6// RUN: clang-scan-deps -compilation-database %t/build/cdb.json \7// RUN:   -format experimental-full --optimize-args=vfs > %t/deps.json8// RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t9 10// CHECK:      {11// CHECK-NEXT:   "modules": [12// CHECK-NEXT:     {13// CHECK-NEXT:       "clang-module-deps": [14// CHECK-NEXT:         {15// CHECK-NEXT:           "context-hash": "{{.*}}",16// CHECK-NEXT:           "module-name": "B"17// CHECK-NEXT:         },18// CHECK-NEXT:         {19// CHECK-NEXT:           "context-hash": "{{.*}}",20// CHECK-NEXT:           "module-name": "C"21// CHECK-NEXT:         }22// CHECK-NEXT:       ],23// CHECK-NEXT:       "clang-modulemap-file": "[[PREFIX]]/moduleA/module.modulemap",24// CHECK-NEXT:       "command-line": [25// Module A needs the VFS overlay because its dependency, module B, needs it.26// CHECK:              "-ivfsoverlay"27// CHECK-NEXT:         "[[PREFIX]]/build/vfs.yaml"28// CHECK:            ],29// CHECK-NEXT:       "context-hash": "{{.*}}",30// CHECK-NEXT:       "file-deps": [31// CHECK:            ],32// CHECK-NEXT:       "link-libraries": [],33// CHECK-NEXT:       "name": "A"34// CHECK-NEXT:     },35// CHECK-NEXT:     {36// CHECK-NEXT:       "clang-module-deps": [],37// CHECK-NEXT:       "clang-modulemap-file": "[[PREFIX]]/moduleB/module.modulemap",38// CHECK-NEXT:       "command-line": [39// Module B needs the VFS overlay because it provides the header referred to by the module map.40// CHECK:              "-ivfsoverlay"41// CHECK-NEXT:         "[[PREFIX]]/build/vfs.yaml"42// CHECK:            ],43// CHECK-NEXT:       "context-hash": "{{.*}}",44// CHECK-NEXT:       "file-deps": [45// CHECK:            ],46// CHECK-NEXT:       "link-libraries": [],47// CHECK-NEXT:       "name": "B"48// CHECK-NEXT:     },49// CHECK-NEXT:     {50// CHECK-NEXT:       "clang-module-deps": [],51// CHECK-NEXT:       "clang-modulemap-file": "[[PREFIX]]/moduleC/module.modulemap",52// CHECK-NEXT:       "command-line": [53// Module C doesn't need the VFS overlay.54// CHECK-NOT:          "-ivfsoverlay"55// CHECK:            ],56// CHECK-NEXT:       "context-hash": "{{.*}}",57// CHECK-NEXT:       "file-deps": [58// CHECK:            ],59// CHECK-NEXT:       "link-libraries": [],60// CHECK-NEXT:       "name": "C"61// CHECK-NEXT:     }62// CHECK-NEXT:   ],63// CHECK-NEXT:   "translation-units": [64// CHECK:        ]65// CHECK:      }66 67//--- build/cdb.json.in68[{69  "directory": "DIR",70  "command": "clang -c DIR/tu.m -I DIR/moduleA -I DIR/moduleB -I DIR/moduleC -fmodules -fmodules-cache-path=DIR/cache -fimplicit-module-maps -ivfsoverlay DIR/build/vfs.yaml",71  "file": "DIR/tu.m"72}]73 74//--- build/vfs.yaml.in75{76  "version": 0,77  "case-sensitive": "false",78  "roots": [79    {80      "contents": [81        {82          "external-contents": "DIR/build/B.h",83          "name": "B.h",84          "type": "file"85        }86      ],87      "name": "DIR/moduleB",88      "type": "directory"89    }90  ]91}92 93//--- tu.m94@import A;95 96//--- moduleA/module.modulemap97module A { header "A.h" }98//--- moduleA/A.h99@import B;100@import C;101 102//--- moduleB/module.modulemap103module B { header "B.h" }104//--- build/B.h105 106//--- moduleC/module.modulemap107module C { header "C.h" }108//--- moduleC/C.h109