https://github.com/ian-twilightcoder created 
https://github.com/llvm/llvm-project/pull/139335

None

>From 075cc877b9db1435c1d74bc476b807dd564b8fb9 Mon Sep 17 00:00:00 2001
From: Ian Anderson <i...@apple.com>
Date: Fri, 9 May 2025 16:11:23 -0700
Subject: [PATCH] [clang][unittests] Fix a leak in SearchPathTest

---
 clang/unittests/Frontend/SearchPathTest.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/unittests/Frontend/SearchPathTest.cpp 
b/clang/unittests/Frontend/SearchPathTest.cpp
index 5d382a4ee20a8..2ebe74d47eb02 100644
--- a/clang/unittests/Frontend/SearchPathTest.cpp
+++ b/clang/unittests/Frontend/SearchPathTest.cpp
@@ -51,6 +51,7 @@ class SearchPathTest : public ::testing::Test {
   FileManager FileMgr;
   SourceManager SourceMgr;
   std::unique_ptr<CompilerInvocation> Invocation;
+  IntrusiveRefCntPtr<TargetInfo> Target;
 
   void addDirectories(ArrayRef<StringRef> Dirs) {
     for (StringRef Dir : Dirs) {
@@ -65,10 +66,9 @@ class SearchPathTest : public ::testing::Test {
     CompilerInvocation::CreateFromArgs(*Invocation, Args, Diags);
     HeaderSearchOptions HSOpts = Invocation->getHeaderSearchOpts();
     LangOptions LangOpts = Invocation->getLangOpts();
-    TargetInfo *Target =
-        TargetInfo::CreateTargetInfo(Diags, Invocation->getTargetOpts());
+    Target = TargetInfo::CreateTargetInfo(Diags, Invocation->getTargetOpts());
     auto HeaderInfo = std::make_unique<HeaderSearch>(HSOpts, SourceMgr, Diags,
-                                                     LangOpts, Target);
+                                                     LangOpts, Target.get());
     ApplyHeaderSearchOptions(*HeaderInfo, HSOpts, LangOpts,
                              Target->getTriple());
     return HeaderInfo;

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to