[clang] [clang][Driver] Use shared_ptr in the Compilation class (PR #116406)

David Truby via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 06:13:23 PST 2024


================
@@ -63,41 +56,39 @@ Compilation::getArgsForToolChain(const ToolChain *TC, StringRef BoundArch,
   if (!TC)
     TC = &DefaultToolChain;
 
-  DerivedArgList *&Entry = TCArgs[{TC, BoundArch, DeviceOffloadKind}];
+  std::shared_ptr<DerivedArgList> &Entry =
+      TCArgs[{TC, BoundArch, DeviceOffloadKind}];
   if (!Entry) {
     SmallVector<Arg *, 4> AllocatedArgs;
-    DerivedArgList *OpenMPArgs = nullptr;
+    std::shared_ptr<DerivedArgList> OpenMPArgs;
----------------
DavidTruby wrote:

```suggestion
    std::unique_ptr<DerivedArgList> OpenMPArgs;
```

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


More information about the cfe-commits mailing list