[clang] [clang] Use std::make_unique (NFC) (PR #97176)

2024-06-29 Thread Kazu Hirata via cfe-commits

https://github.com/kazutakahirata closed 
https://github.com/llvm/llvm-project/pull/97176
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Use std::make_unique (NFC) (PR #97176)

2024-06-29 Thread David Blaikie via cfe-commits

https://github.com/dwblaikie approved this pull request.


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


[clang] [clang] Use std::make_unique (NFC) (PR #97176)

2024-06-29 Thread David Blaikie via cfe-commits

https://github.com/dwblaikie edited 
https://github.com/llvm/llvm-project/pull/97176
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Use std::make_unique (NFC) (PR #97176)

2024-06-29 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-codegen

Author: Kazu Hirata (kazutakahirata)


Changes

This patch is based on clang-tidy's modernize-make-unique but limited
to those cases where type names are mentioned twice like
std::unique_ptrType(new Type()), which is a bit mouthful.


---
Full diff: https://github.com/llvm/llvm-project/pull/97176.diff


2 Files Affected:

- (modified) clang/lib/CodeGen/CGCoroutine.cpp (+1-1) 
- (modified) clang/lib/Interpreter/CodeCompletion.cpp (+1-2) 


``diff
diff --git a/clang/lib/CodeGen/CGCoroutine.cpp 
b/clang/lib/CodeGen/CGCoroutine.cpp
index b4c724422c14a..a8a70186c2c5a 100644
--- a/clang/lib/CodeGen/CGCoroutine.cpp
+++ b/clang/lib/CodeGen/CGCoroutine.cpp
@@ -103,7 +103,7 @@ static void createCoroData(CodeGenFunction ,
 return;
   }
 
-  CurCoro.Data = std::unique_ptr(new CGCoroData);
+  CurCoro.Data = std::make_unique();
   CurCoro.Data->CoroId = CoroId;
   CurCoro.Data->CoroIdExpr = CoroIdExpr;
 }
diff --git a/clang/lib/Interpreter/CodeCompletion.cpp 
b/clang/lib/Interpreter/CodeCompletion.cpp
index 25183ae9eeb99..791426807cb91 100644
--- a/clang/lib/Interpreter/CodeCompletion.cpp
+++ b/clang/lib/Interpreter/CodeCompletion.cpp
@@ -368,8 +368,7 @@ void ReplCodeCompleter::codeComplete(CompilerInstance 
*InterpCI,
   llvm::SmallVector tb = {};
   InterpCI->getFrontendOpts().Inputs[0] = FrontendInputFile(
   CodeCompletionFileName, Language::CXX, InputKind::Source);
-  auto Act = std::unique_ptr(
-  new IncrementalSyntaxOnlyAction(ParentCI));
+  auto Act = std::make_unique(ParentCI);
   std::unique_ptr MB =
   llvm::MemoryBuffer::getMemBufferCopy(Content, CodeCompletionFileName);
   llvm::SmallVector RemappedFiles;

``




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


[clang] [clang] Use std::make_unique (NFC) (PR #97176)

2024-06-29 Thread Kazu Hirata via cfe-commits

https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/97176

This patch is based on clang-tidy's modernize-make-unique but limited
to those cases where type names are mentioned twice like
std::unique_ptr(new Type()), which is a bit mouthful.


>From 84e939e920af0c54092362d854850be2c6dd2897 Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Sat, 29 Jun 2024 06:28:42 -0700
Subject: [PATCH] [clang] Use std::make_unique (NFC)

This patch is based on clang-tidy's modernize-make-unique but limited
to those cases where type names are mentioned twice like
std::unique_ptr(new Type()), which is a bit mouthful.
---
 clang/lib/CodeGen/CGCoroutine.cpp| 2 +-
 clang/lib/Interpreter/CodeCompletion.cpp | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/clang/lib/CodeGen/CGCoroutine.cpp 
b/clang/lib/CodeGen/CGCoroutine.cpp
index b4c724422c14a..a8a70186c2c5a 100644
--- a/clang/lib/CodeGen/CGCoroutine.cpp
+++ b/clang/lib/CodeGen/CGCoroutine.cpp
@@ -103,7 +103,7 @@ static void createCoroData(CodeGenFunction ,
 return;
   }
 
-  CurCoro.Data = std::unique_ptr(new CGCoroData);
+  CurCoro.Data = std::make_unique();
   CurCoro.Data->CoroId = CoroId;
   CurCoro.Data->CoroIdExpr = CoroIdExpr;
 }
diff --git a/clang/lib/Interpreter/CodeCompletion.cpp 
b/clang/lib/Interpreter/CodeCompletion.cpp
index 25183ae9eeb99..791426807cb91 100644
--- a/clang/lib/Interpreter/CodeCompletion.cpp
+++ b/clang/lib/Interpreter/CodeCompletion.cpp
@@ -368,8 +368,7 @@ void ReplCodeCompleter::codeComplete(CompilerInstance 
*InterpCI,
   llvm::SmallVector tb = {};
   InterpCI->getFrontendOpts().Inputs[0] = FrontendInputFile(
   CodeCompletionFileName, Language::CXX, InputKind::Source);
-  auto Act = std::unique_ptr(
-  new IncrementalSyntaxOnlyAction(ParentCI));
+  auto Act = std::make_unique(ParentCI);
   std::unique_ptr MB =
   llvm::MemoryBuffer::getMemBufferCopy(Content, CodeCompletionFileName);
   llvm::SmallVector RemappedFiles;

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