diff --git a/clang/test/ClangScanDeps/include-tree-vfs-overlay.c b/clang/test/ClangScanDeps/include-tree-vfs-overlay.c new file mode 100644 index 0000000000000..c6bacbbf06edc --- /dev/null +++ b/clang/test/ClangScanDeps/include-tree-vfs-overlay.c @@ -0,0 +1,37 @@ +// REQUIRES: ondisk_cas + +// This is a reduced test for https://github.com/swiftlang/llvm-project/issues/11616 + +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: sed -e "s|DIR|%/t|g" %t/vfs-overlay.yaml.template > %t/vfs-overlay.yaml + +// RUN: %clang -I%t -fdepscan=inline -fdepscan-include-tree -Xclang -fcas-path -Xclang %t/cas -Xclang -ivfsoverlay -Xclang %t/vfs-overlay.yaml -c %t/test.c + +//--- test.c +#include "header.h" +#include "header1.h" + +//--- header.h + +//--- header2.h + +//--- header3.h + +//--- vfs-overlay.yaml.template +version: 0 +case-sensitive: false +roots: + - name: "DIR" + type: directory + contents: + - name: header.h + type: file + external-contents: "DIR/header.h" + - name: header1.h + type: file + external-contents: "DIR/header2.h" + - name: header2.h + type: file + external-contents: "DIR/header3.h" + diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp index da5e74867a598..6435a55aea027 100644 --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -2551,6 +2551,11 @@ class FileWithFixedStatus : public File { std::error_code close() override { return InnerFile->close(); } void setPath(const Twine &Path) override { S = S.copyWithNewName(S, Path); } + + llvm::ErrorOr> getObjectRefForContent() + override { + return InnerFile->getObjectRefForContent(); + } }; } // namespace