================
@@ -1544,8 +1544,8 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char
*> ArgList) {
}
// The compilation takes ownership of Args.
- Compilation *C = new Compilation(*this, TC, UArgs.release(), TranslatedArgs,
- ContainsError);
+ Compilation *C = new Compilation(*this, TC, std::move(UArgs),
+ std::move(TranslatedArgs), ContainsError);
----------------
DavidTruby wrote:
You're moving from TranslatedArgs here but it's used again in a few lines,
where it will be `nullptr`. I think if you want to do this then TranslatedArgs
should be a `std::shared_ptr` in this function, as it already is inside the
`Compilation` class in your patch, and then it doesn't need to be moved from
here.
Alternatively you can use C->getArgs() on line 1555 instead of TranslatedArgs.
I recommend doing LLVM builds with the `-DLLVM_ENABLE_ASSERTIONS=On` cmake
option when doing LLVM development as it catches these kinds of issues. The CI
uses that flag and didn't pass because `std::unique_ptr::operator*` has an
assertion that the pointer isn't null.
https://github.com/llvm/llvm-project/pull/116406
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits