================
@@ -216,7 +216,7 @@ enum OpenCLTypeKind : uint8_t {
 ///
 class TargetInfo : public TransferrableTargetInfo,
                    public RefCountedBase<TargetInfo> {
-  std::shared_ptr<TargetOptions> TargetOpts;
+  TargetOptions *TargetOpts;
----------------
kadircet wrote:

this is making me a little anxious. previously a `TargetInfo` was valid even if 
`TargetOptions` used during construction went away.

now we're breaking that contract, any code pattern that keeps `TargetInfo`s 
alive, now needs to make sure underlying options are outliving it. AFAICT, you 
ensured usages upstream are updated accordingly (and are safe), but I am afraid 
this might break downstream projects. This is fine, but it would be nice to 
prevent it if we can.

I do understand we need to hide `TargetOptions` from `CompilerInvocation`, but 
do we have a reason to make this reference non-owning ? (this should also 
ensure we don't create a new unique_ptr for AuxTargetOpts in 
`CompilerInstance.h`.

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

Reply via email to