r207792 - Use make_unique<T>(...) rather than unique_ptr<T>(new T(...))

David Blaikie dblaikie at gmail.com
Thu May 1 13:46:30 PDT 2014


Author: dblaikie
Date: Thu May  1 15:46:30 2014
New Revision: 207792

URL: http://llvm.org/viewvc/llvm-project?rev=207792&view=rev
Log:
Use make_unique<T>(...) rather than unique_ptr<T>(new T(...))

Modified:
    cfe/trunk/include/clang/Tooling/Tooling.h

Modified: cfe/trunk/include/clang/Tooling/Tooling.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Tooling.h?rev=207792&r1=207791&r2=207792&view=diff
==============================================================================
--- cfe/trunk/include/clang/Tooling/Tooling.h (original)
+++ cfe/trunk/include/clang/Tooling/Tooling.h Thu May  1 15:46:30 2014
@@ -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> n
     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<FrontendActionFac
     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





More information about the cfe-commits mailing list