[clang] [clang-tools-extra] [clang] Hide the `TargetOptions` pointer from `CompilerInvocation` (PR #106271)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 6 13:56:57 PDT 2024


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

Upstream breaks internal APIs all the time. This one in particular seems pretty safe: the `TargetInfo` constructor now takes `TargetOptions &` instead of `const std::shared_ptr<TargetOptions> &`, which will result in a compilation error with an understandable diagnostic. The expected lifetime of the reference is documented, so I don't see this being an issue.

https://github.com/llvm/llvm-project/pull/106271


More information about the cfe-commits mailing list