[PATCH] D136124: [clang][deps] Remove unintentional `move`

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 17 20:05:13 PDT 2022


jansvoboda11 created this revision.
jansvoboda11 added a reviewer: DavidSpickett.
Herald added a subscriber: ributzka.
Herald added a project: All.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This is a fix related to D135414 <https://reviews.llvm.org/D135414>. The original intention was to keep `BaseFS` as a member of the worker and conditionally overlay it with local in-memory FS. The `move` of ref-counted `BaseFS` was not intended, and it's a bug.

Disabling parallelism in the "by-module-name" test reliably reproduces this, and the test itself doesn't *need* parallelism. (I think `-j 4` was cargo culted from another test.) Reusing that test to check for correct behavior...


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136124

Files:
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
  clang/test/ClangScanDeps/modules-full-by-mod-name.cpp


Index: clang/test/ClangScanDeps/modules-full-by-mod-name.cpp
===================================================================
--- clang/test/ClangScanDeps/modules-full-by-mod-name.cpp
+++ clang/test/ClangScanDeps/modules-full-by-mod-name.cpp
@@ -11,11 +11,11 @@
 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb_by_mod_name.json > %t.cdb
 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb_clangcl_by_mod_name.json > %t_clangcl.cdb
 //
-// RUN: clang-scan-deps -compilation-database %t.cdb -j 4 -format experimental-full \
+// RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -format experimental-full \
 // RUN:   -mode preprocess-dependency-directives -module-name=header1 > %t.result
 // RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK %s
 //
-// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 4 -format experimental-full \
+// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 1 -format experimental-full \
 // RUN:   -mode preprocess-dependency-directives -module-name=header1 > %t_clangcl.result
 // RUN: cat %t_clangcl.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK %s
 
Index: clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
===================================================================
--- clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -396,8 +396,8 @@
     ModifiedCommandLine = CommandLine;
     ModifiedCommandLine->emplace_back(*ModuleName);
 
-    auto OverlayFS = llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(
-        std::move(BaseFS));
+    auto OverlayFS =
+        llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(BaseFS);
     auto InMemoryFS =
         llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
     InMemoryFS->setCurrentWorkingDirectory(WorkingDirectory);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136124.468399.patch
Type: text/x-patch
Size: 1954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221018/8f5418d7/attachment.bin>


More information about the cfe-commits mailing list