]> granicus.if.org Git - clang/commitdiff
Use make_unique<T>(...) rather than unique_ptr<T>(new T(...))
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 1 May 2014 20:46:30 +0000 (20:46 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 1 May 2014 20:46:30 +0000 (20:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207792 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Tooling/Tooling.h

index a0d6cb789cf446ca89b823ed544e0cfb09a30ce8..909ca2fea7ca9e3c980d9e2576a04810ae0465f7 100644 (file)
@@ -39,6 +39,7 @@
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/ADT/STLExtras.h"
 #include <memory>
 #include <string>
 #include <vector>
@@ -311,8 +312,7 @@ std::unique_ptr<FrontendActionFactory> newFrontendActionFactory() {
     clang::FrontendAction *create() override { return new T; }
   };
 
-  return std::unique_ptr<FrontendActionFactory>(
-      new SimpleFrontendActionFactory);
+  return llvm::make_unique<SimpleFrontendActionFactory>();
 }
 
 template <typename FactoryT>
@@ -363,8 +363,8 @@ inline std::unique_ptr<FrontendActionFactory> newFrontendActionFactory(
     SourceFileCallbacks *Callbacks;
   };
 
-  return std::unique_ptr<FrontendActionFactory>(
-      new FrontendActionFactoryAdapter(ConsumerFactory, Callbacks));
+  return llvm::make_unique<FrontendActionFactoryAdapter>(ConsumerFactory,
+                                                         Callbacks);
 }
 
 /// \brief Returns the absolute path of \c File, by prepending it with