martinboehme wrote:

@ymand PTAL -- I noticed that my initial version had a use-after-move on this 
line:

```cxx
  DataflowAnalysisContext(std::unique_ptr<Solver> S,
                          Options Opts = Options{
                              /*ContextSensitiveOpts=*/std::nullopt,
                              /*Logger=*/nullptr})
      : DataflowAnalysisContext(*S, std::move(S), Opts) {}
```

This was because the private constructor to which this constructor delegates 
originally took the `std::unique_ptr<Solver>` by value, and the order in which 
the arguments are evaluated is indeterminate.

I've now changed the parameter of the private constructor to be an rvalue 
reference (`std::unique_ptr<Solver> &&`), which resolves this issue as the move 
only happens inside the constructor.

https://github.com/llvm/llvm-project/pull/91316
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to