The bug appeared when clang-scan-deps was run from a different directory than the one provided in the "directory" entry.
Details
Diff Detail
Event Timeline
Updated the patch.
Followed suggestion from @dexonsmith. Indeed it simplifies the code.
Also, improved the test, to also test with -j 2
A couple of more comments. @arphaman , can you confirm this is a good direction?
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp | ||
---|---|---|
158–160 | I think this can just be: RealFS = llvm::vfs::createPhysicalFileSystem(); The ProxyFileSystem wrapper is a convenience for building other file systems; it doesn't do anything on its own IIRC. | |
clang/test/ClangScanDeps/relative_directory.cpp | ||
12–13 | Can you use CHECK-DAG for this? | |
19–25 | I.e., maybe this can be: // CHECK-DAG: relative_directory_input1.o: // CHECK-DAG: relative_directory_input1.cpp // CHECK-DAG: header.h // CHECK-DAG: relative_directory_input2.o: // CHECK-DAG: relative_directory_input2.cpp // CHECK-DAG: header.h |
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp | ||
---|---|---|
158–160 | Note that createPhysicalFileSystem() returns a std::unique_ptr whereas getRealFileSystem() return type is llvm::IntrusiveRfCntPtr. Trying to change the type of RealFS requires more changes, as DependencyScanningWorkerFilesystem is itself a ProxyFileSystem and thus requires a llvm::IntrusiveRfCntPtr object. Should DependencyScanningWorkerFilesystem not be a ProxyFileSystem? @arphaman WDYT? I updated my patch for an intermediate fix, which also passes the tests: RealFS = llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>(llvm::vfs::createPhysicalFileSystem().release()); | |
clang/test/ClangScanDeps/relative_directory.cpp | ||
12–13 | If I understand correctly from the doc, it would lose the order (CHECK1, CHECK1-NEXT). I did this mimicking what is done in other tests like regular_cdb.cpp. |
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp | ||
---|---|---|
158–160 | Ah, didn't realize it returned unique_ptr. RealFS should be IntrusiveRefCntPtr, but you can be less verbose like this: RealFS = llvm::vfs::createPhysicalFileSystem().release(); |
clang/test/ClangScanDeps/relative_directory.cpp | ||
---|---|---|
12–13 |
We need 2 blocks of 3 lines to be present, but only the blocks can be in any order. That's correct, but I think it's safe to assume in this test that the general format of the output is correct. Best would be to add a CHECK-DAG-NEXT: feature to FileCheck but that seems above and beyond for fixing this bug.
Sure, it's probably fine either way, and it might be better to match the other tests. |
This LGTM, but I'd like @arphaman to look as well in case he originally tried getPhysicalFileSystem and it caused a problem. I've switched him to a blocking reviewer.
I think this can just be:
The ProxyFileSystem wrapper is a convenience for building other file systems; it doesn't do anything on its own IIRC.