This PR builds on top of #113984 and attempts to avoid allocating input file paths eagerly. Instead, the `InputFileInfo` type used by `ASTReader` now only holds `StringRef`s that point into the PCM file buffer, and the full input file paths get resolved on demand. The dependency scanner makes use of this in a bit of a roundabout way: `ModuleDeps` now only holds (an owning copy of) the short unresolved input file paths, which get resolved lazily. This can be a big win, I'm seeing up to a 5% speedup.
60 lines
1.9 KiB
C
60 lines
1.9 KiB
C
// RUN: rm -rf %t
|
|
// RUN: split-file %s %t
|
|
|
|
//--- tu.m
|
|
#include "first.h"
|
|
|
|
//--- first/module.modulemap
|
|
module first { header "first.h" }
|
|
//--- first/first.h
|
|
#include "second.h"
|
|
|
|
//--- second/module.modulemap
|
|
module second { header "second.h" }
|
|
//--- second/second.h
|
|
#include "third.h"
|
|
|
|
//--- third/module.modulemap
|
|
module third { header "third.h" }
|
|
//--- third/third.h
|
|
// empty
|
|
|
|
//--- cdb.json.template
|
|
[{
|
|
"file": "DIR/tu.c",
|
|
"directory": "DIR",
|
|
"command": "clang -I DIR/first -I DIR/second -I DIR/third -fmodules -fmodules-cache-path=DIR/cache -c DIR/tu.m -o DIR/tu.o"
|
|
}]
|
|
|
|
// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
|
|
// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
|
|
// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
|
|
|
|
// CHECK: {
|
|
// CHECK-NEXT: "modules": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "clang-module-deps": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "context-hash": "{{.*}}",
|
|
// CHECK-NEXT: "module-name": "second"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ],
|
|
// CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/first/module.modulemap",
|
|
// CHECK-NEXT: "command-line": [
|
|
// CHECK-NEXT: "-cc1",
|
|
// CHECK-NOT: "-fmodule-map-file=[[PREFIX]]/third/module.modulemap"
|
|
// CHECK: "-fmodule-map-file=[[PREFIX]]/second/module.modulemap"
|
|
// CHECK-NOT: "-fmodule-map-file=[[PREFIX]]/third/module.modulemap"
|
|
// CHECK: ],
|
|
// CHECK-NEXT: "context-hash": "{{.*}}",
|
|
// CHECK-NEXT: "file-deps": [
|
|
// CHECK-NEXT: "[[PREFIX]]/first/module.modulemap",
|
|
// CHECK-NEXT: "[[PREFIX]]/first/first.h",
|
|
// CHECK-NEXT: "[[PREFIX]]/second/module.modulemap"
|
|
// CHECK-NEXT: ],
|
|
// CHECK-NEXT: "link-libraries": [],
|
|
// CHECK-NEXT: "name": "first"
|
|
// CHECK-NEXT: }
|
|
// CHECK: ]
|
|
// CHECK: }
|