[PATCH] D93185: [docs] Use make_unique in FrontendAction example

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 20 10:48:07 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2da4ceec936e: [docs] Use make_unique in FrontendAction example (authored by nicolas17, committed by thakis).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93185/new/

https://reviews.llvm.org/D93185

Files:
  clang/docs/RAVFrontendAction.rst


Index: clang/docs/RAVFrontendAction.rst
===================================================================
--- clang/docs/RAVFrontendAction.rst
+++ clang/docs/RAVFrontendAction.rst
@@ -27,8 +27,7 @@
       public:
         virtual std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(
           clang::CompilerInstance &Compiler, llvm::StringRef InFile) {
-          return std::unique_ptr<clang::ASTConsumer>(
-              new FindNamedClassConsumer);
+          return std::make_unique<FindNamedClassConsumer>();
         }
       };
 
@@ -114,8 +113,7 @@
 
       virtual std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(
         clang::CompilerInstance &Compiler, llvm::StringRef InFile) {
-        return std::unique_ptr<clang::ASTConsumer>(
-            new FindNamedClassConsumer(&Compiler.getASTContext()));
+        return std::make_unique<FindNamedClassConsumer>(&Compiler.getASTContext());
       }
 
 Now that the ASTContext is available in the RecursiveASTVisitor, we can
@@ -189,8 +187,7 @@
       public:
         virtual std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(
           clang::CompilerInstance &Compiler, llvm::StringRef InFile) {
-          return std::unique_ptr<clang::ASTConsumer>(
-              new FindNamedClassConsumer(&Compiler.getASTContext()));
+          return std::make_unique<FindNamedClassConsumer>(&Compiler.getASTContext());
         }
       };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93185.338923.patch
Type: text/x-patch
Size: 1411 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210420/d4d96ad7/attachment.bin>


More information about the cfe-commits mailing list