r203388 - [C++11] Remove the remaining uses of OwningPtr.
Ahmed Charles
ahmedcharles at gmail.com
Sun Mar 9 04:34:25 PDT 2014
Author: ace2001ac
Date: Sun Mar 9 06:34:25 2014
New Revision: 203388
URL: http://llvm.org/viewvc/llvm-project?rev=203388&view=rev
Log:
[C++11] Remove the remaining uses of OwningPtr.
Replace OwningArrayPtr with std::unique_ptr<T[]>.
Modified:
cfe/trunk/examples/analyzer-plugin/MainCallChecker.cpp
cfe/trunk/examples/clang-interpreter/main.cpp
cfe/trunk/include/clang/ARCMigrate/FileRemapper.h
cfe/trunk/include/clang/AST/VTableBuilder.h
cfe/trunk/include/clang/Basic/LLVM.h
cfe/trunk/include/clang/Frontend/CompilerInstance.h
cfe/trunk/include/clang/Frontend/MultiplexConsumer.h
cfe/trunk/include/clang/Rewrite/Core/TokenRewriter.h
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/include/clang/Tooling/FileMatchTrie.h
cfe/trunk/lib/ARCMigrate/ARCMT.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
Modified: cfe/trunk/examples/analyzer-plugin/MainCallChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/analyzer-plugin/MainCallChecker.cpp?rev=203388&r1=203387&r2=203388&view=diff
==============================================================================
--- cfe/trunk/examples/analyzer-plugin/MainCallChecker.cpp (original)
+++ cfe/trunk/examples/analyzer-plugin/MainCallChecker.cpp Sun Mar 9 06:34:25 2014
@@ -8,7 +8,7 @@ using namespace ento;
namespace {
class MainCallChecker : public Checker < check::PreStmt<CallExpr> > {
- mutable OwningPtr<BugType> BT;
+ mutable std::unique_ptr<BugType> BT;
public:
void checkPreStmt(const CallExpr *CE, CheckerContext &C) const;
Modified: cfe/trunk/examples/clang-interpreter/main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/clang-interpreter/main.cpp?rev=203388&r1=203387&r2=203388&view=diff
==============================================================================
--- cfe/trunk/examples/clang-interpreter/main.cpp (original)
+++ cfe/trunk/examples/clang-interpreter/main.cpp Sun Mar 9 06:34:25 2014
@@ -46,8 +46,8 @@ static int Execute(llvm::Module *Mod, ch
llvm::InitializeNativeTarget();
std::string Error;
- OwningPtr<llvm::ExecutionEngine> EE(
- llvm::ExecutionEngine::createJIT(Mod, &Error));
+ std::unique_ptr<llvm::ExecutionEngine> EE(
+ llvm::ExecutionEngine::createJIT(Mod, &Error));
if (!EE) {
llvm::errs() << "unable to make execution engine: " << Error << "\n";
return 255;
@@ -83,7 +83,7 @@ int main(int argc, const char **argv, ch
// (basically, exactly one input, and the operation mode is hard wired).
SmallVector<const char *, 16> Args(argv, argv + argc);
Args.push_back("-fsyntax-only");
- OwningPtr<Compilation> C(TheDriver.BuildCompilation(Args));
+ std::unique_ptr<Compilation> C(TheDriver.BuildCompilation(Args));
if (!C)
return 0;
@@ -108,7 +108,7 @@ int main(int argc, const char **argv, ch
// Initialize a compiler invocation object from the clang (-cc1) arguments.
const driver::ArgStringList &CCArgs = Cmd->getArguments();
- OwningPtr<CompilerInvocation> CI(new CompilerInvocation);
+ std::unique_ptr<CompilerInvocation> CI(new CompilerInvocation);
CompilerInvocation::CreateFromArgs(*CI,
const_cast<const char **>(CCArgs.data()),
const_cast<const char **>(CCArgs.data()) +
@@ -140,7 +140,7 @@ int main(int argc, const char **argv, ch
CompilerInvocation::GetResourcesPath(argv[0], MainAddr);
// Create and execute the frontend to generate an LLVM bitcode module.
- OwningPtr<CodeGenAction> Act(new EmitLLVMOnlyAction());
+ std::unique_ptr<CodeGenAction> Act(new EmitLLVMOnlyAction());
if (!Clang.ExecuteAction(*Act))
return 1;
Modified: cfe/trunk/include/clang/ARCMigrate/FileRemapper.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ARCMigrate/FileRemapper.h?rev=203388&r1=203387&r2=203388&view=diff
==============================================================================
--- cfe/trunk/include/clang/ARCMigrate/FileRemapper.h (original)
+++ cfe/trunk/include/clang/ARCMigrate/FileRemapper.h Sun Mar 9 06:34:25 2014
@@ -12,9 +12,9 @@
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/StringRef.h"
+#include <memory>
namespace llvm {
class MemoryBuffer;
Modified: cfe/trunk/include/clang/AST/VTableBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/VTableBuilder.h?rev=203388&r1=203387&r2=203388&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/VTableBuilder.h (original)
+++ cfe/trunk/include/clang/AST/VTableBuilder.h Sun Mar 9 06:34:25 2014
@@ -209,11 +209,11 @@ public:
typedef llvm::DenseMap<BaseSubobject, uint64_t> AddressPointsMapTy;
private:
uint64_t NumVTableComponents;
- llvm::OwningArrayPtr<VTableComponent> VTableComponents;
+ std::unique_ptr<VTableComponent[]> VTableComponents;
/// \brief Contains thunks needed by vtables, sorted by indices.
uint64_t NumVTableThunks;
- llvm::OwningArrayPtr<VTableThunkTy> VTableThunks;
+ std::unique_ptr<VTableThunkTy[]> VTableThunks;
/// \brief Address points for all vtables.
AddressPointsMapTy AddressPoints;
Modified: cfe/trunk/include/clang/Basic/LLVM.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LLVM.h?rev=203388&r1=203387&r2=203388&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LLVM.h (original)
+++ cfe/trunk/include/clang/Basic/LLVM.h Sun Mar 9 06:34:25 2014
@@ -29,7 +29,6 @@ namespace llvm {
class StringRef;
class Twine;
template<typename T> class ArrayRef;
- template<typename T> class OwningPtr;
template<unsigned InternalLen> class SmallString;
template<typename T, unsigned N> class SmallVector;
template<typename T> class SmallVectorImpl;
@@ -63,7 +62,6 @@ namespace clang {
using llvm::StringRef;
using llvm::Twine;
using llvm::ArrayRef;
- using llvm::OwningPtr;
using llvm::SmallString;
using llvm::SmallVector;
using llvm::SmallVectorImpl;
Modified: cfe/trunk/include/clang/Frontend/CompilerInstance.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInstance.h?rev=203388&r1=203387&r2=203388&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInstance.h Sun Mar 9 06:34:25 2014
@@ -106,7 +106,7 @@ class CompilerInstance : public ModuleLo
IntrusiveRefCntPtr<ASTReader> ModuleManager;
/// \brief The dependency file generator.
- OwningPtr<DependencyFileGenerator> TheDependencyFileGenerator;
+ std::unique_ptr<DependencyFileGenerator> TheDependencyFileGenerator;
/// \brief The set of top-level modules that has already been loaded,
/// along with the module map
Modified: cfe/trunk/include/clang/Frontend/MultiplexConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/MultiplexConsumer.h?rev=203388&r1=203387&r2=203388&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/MultiplexConsumer.h (original)
+++ cfe/trunk/include/clang/Frontend/MultiplexConsumer.h Sun Mar 9 06:34:25 2014
@@ -17,7 +17,7 @@
#include "clang/Basic/LLVM.h"
#include "clang/Sema/SemaConsumer.h"
-#include "llvm/ADT/OwningPtr.h"
+#include <memory>
#include <vector>
namespace clang {
Modified: cfe/trunk/include/clang/Rewrite/Core/TokenRewriter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Rewrite/Core/TokenRewriter.h?rev=203388&r1=203387&r2=203388&view=diff
==============================================================================
--- cfe/trunk/include/clang/Rewrite/Core/TokenRewriter.h (original)
+++ cfe/trunk/include/clang/Rewrite/Core/TokenRewriter.h Sun Mar 9 06:34:25 2014
@@ -17,9 +17,9 @@
#include "clang/Basic/SourceLocation.h"
#include "clang/Lex/Token.h"
-#include "llvm/ADT/OwningPtr.h"
#include <list>
#include <map>
+#include <memory>
namespace clang {
class LangOptions;
Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=203388&r1=203387&r2=203388&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Sun Mar 9 06:34:25 2014
@@ -188,8 +188,9 @@ public:
/// \brief Simple wrapper class for chaining listeners.
class ChainedASTReaderListener : public ASTReaderListener {
- OwningPtr<ASTReaderListener> First;
- OwningPtr<ASTReaderListener> Second;
+ std::unique_ptr<ASTReaderListener> First;
+ std::unique_ptr<ASTReaderListener> Second;
+
public:
/// Takes ownership of \p First and \p Second.
ChainedASTReaderListener(ASTReaderListener *First, ASTReaderListener *Second)
Modified: cfe/trunk/include/clang/Tooling/FileMatchTrie.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/FileMatchTrie.h?rev=203388&r1=203387&r2=203388&view=diff
==============================================================================
--- cfe/trunk/include/clang/Tooling/FileMatchTrie.h (original)
+++ cfe/trunk/include/clang/Tooling/FileMatchTrie.h Sun Mar 9 06:34:25 2014
@@ -16,8 +16,8 @@
#define LLVM_CLANG_TOOLING_FILE_MATCH_TRIE_H
#include "clang/Basic/LLVM.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringRef.h"
+#include <memory>
#include <string>
#include <vector>
Modified: cfe/trunk/lib/ARCMigrate/ARCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ARCMT.cpp?rev=203388&r1=203387&r2=203388&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ARCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ARCMT.cpp Sun Mar 9 06:34:25 2014
@@ -537,7 +537,7 @@ bool MigrationProcess::applyTransform(Tr
std::unique_ptr<ARCMTMacroTrackerAction> ASTAction;
ASTAction.reset(new ARCMTMacroTrackerAction(ARCMTMacroLocs));
- OwningPtr<ASTUnit> Unit(ASTUnit::LoadFromCompilerInvocationAction(
+ std::unique_ptr<ASTUnit> Unit(ASTUnit::LoadFromCompilerInvocationAction(
CInvok.release(), Diags, ASTAction.get()));
if (!Unit) {
errRec.FinishCapture();
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=203388&r1=203387&r2=203388&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Sun Mar 9 06:34:25 2014
@@ -1631,9 +1631,7 @@ void Sema::WarnExactTypedMethods(ObjCMet
/// memory cost and it would be handy for lookups.
typedef llvm::DenseSet<IdentifierInfo*> ProtocolNameSet;
-typedef llvm::OwningPtr<ProtocolNameSet> LazyProtocolNameSet;
-
-
+typedef std::unique_ptr<ProtocolNameSet> LazyProtocolNameSet;
static void findProtocolsWithExplicitImpls(const ObjCProtocolDecl *PDecl,
ProtocolNameSet &PNS) {
@@ -1691,7 +1689,7 @@ static void CheckProtocolMethodDefs(Sema
// change is restricted to 'objc_protocol_requires_explicit_implementation'
// protocols for now for controlled evaluation.
if (PDecl->hasAttr<ObjCExplicitProtocolImplAttr>()) {
- if (!ProtocolsExplictImpl.isValid()) {
+ if (!ProtocolsExplictImpl) {
ProtocolsExplictImpl.reset(new ProtocolNameSet);
findProtocolsWithExplicitImpls(Super, *ProtocolsExplictImpl);
}
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=203388&r1=203387&r2=203388&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Sun Mar 9 06:34:25 2014
@@ -11685,7 +11685,7 @@ Sema::BuildCallToObjectOfClassType(Scope
// Build the full argument list for the method call (the implicit object
// parameter is placed at the beginning of the list).
- llvm::OwningArrayPtr<Expr *> MethodArgs(new Expr*[Args.size() + 1]);
+ std::unique_ptr<Expr * []> MethodArgs(new Expr *[Args.size() + 1]);
MethodArgs[0] = Object.get();
std::copy(Args.begin(), Args.end(), &MethodArgs[1]);
More information about the cfe-commits
mailing list