[PATCH] D104106: [clang][deps] NFC: Stop using moved-from object

2021-06-14 Thread Jan Svoboda via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG85208b96b85f: [clang][deps] NFC: Stop using moved-from 
object (authored by jansvoboda11).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104106/new/

https://reviews.llvm.org/D104106

Files:
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp


Index: clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
===
--- clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -171,8 +171,8 @@
 // invocation to the collector. The options in the invocation are reset,
 // which ensures that the compiler won't create new dependency collectors,
 // and thus won't write out the extra '.d' files to disk.
-auto Opts = std::make_unique(
-std::move(Compiler.getInvocation().getDependencyOutputOpts()));
+auto Opts = std::make_unique();
+std::swap(*Opts, Compiler.getInvocation().getDependencyOutputOpts());
 // We need at least one -MT equivalent for the generator of make dependency
 // files to work.
 if (Opts->Targets.empty())


Index: clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
===
--- clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -171,8 +171,8 @@
 // invocation to the collector. The options in the invocation are reset,
 // which ensures that the compiler won't create new dependency collectors,
 // and thus won't write out the extra '.d' files to disk.
-auto Opts = std::make_unique(
-std::move(Compiler.getInvocation().getDependencyOutputOpts()));
+auto Opts = std::make_unique();
+std::swap(*Opts, Compiler.getInvocation().getDependencyOutputOpts());
 // We need at least one -MT equivalent for the generator of make dependency
 // files to work.
 if (Opts->Targets.empty())
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104106: [clang][deps] NFC: Stop using moved-from object

2021-06-13 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith accepted this revision.
dexonsmith added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104106/new/

https://reviews.llvm.org/D104106

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104106: [clang][deps] NFC: Stop using moved-from object

2021-06-11 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 created this revision.
jansvoboda11 added reviewers: Bigcheese, dexonsmith, arphaman.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The dependency scanning worker uses `std::move` to "reset" 
`DependencyOutputOptions` in the `CompilerInstance` that performs the implicit 
build. It's probably preferable to replace the object with value-initialized 
instance, rather than depending on the behavior of a moved-from object.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104106

Files:
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp


Index: clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
===
--- clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -169,8 +169,8 @@
 // invocation to the collector. The options in the invocation are reset,
 // which ensures that the compiler won't create new dependency collectors,
 // and thus won't write out the extra '.d' files to disk.
-auto Opts = std::make_unique(
-std::move(Compiler.getInvocation().getDependencyOutputOpts()));
+auto Opts = std::make_unique();
+std::swap(*Opts, Compiler.getInvocation().getDependencyOutputOpts());
 // We need at least one -MT equivalent for the generator of make dependency
 // files to work.
 if (Opts->Targets.empty())


Index: clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
===
--- clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -169,8 +169,8 @@
 // invocation to the collector. The options in the invocation are reset,
 // which ensures that the compiler won't create new dependency collectors,
 // and thus won't write out the extra '.d' files to disk.
-auto Opts = std::make_unique(
-std::move(Compiler.getInvocation().getDependencyOutputOpts()));
+auto Opts = std::make_unique();
+std::swap(*Opts, Compiler.getInvocation().getDependencyOutputOpts());
 // We need at least one -MT equivalent for the generator of make dependency
 // files to work.
 if (Opts->Targets.empty())
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits