jansvoboda11 wrote:

> > The `unique_ptr` in `ASTUnit` always stores a **copy** of the `shared_ptr` 
> > in `CompilerInvocation`.
> 
> And we need `unique_ptr` in `ASTUnit` instead of a direct value so we can 
> change LangOpts in `ASTUnit::Parse`?

Not really, using `LangOptions` directly instead of 
`std::unique_ptr<LangOptions>` allows reassignment too. I chose 
`std::unique_ptr` to:
* prevent increase of `ASTUnit` size,
* avoid unconditional initialization of `ASTUnit:: LangOpts` in the constructor 
(which would be an unnecessary change in this PR I think).

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

Reply via email to