[C++11] Remove the remaining uses of OwningPtr.

Replace OwningArrayPtr with std::unique_ptr<T[]>.

llvm-svn: 203388
This commit is contained in:
Ahmed Charles 2014-03-09 11:34:25 +00:00
parent f9d26f1b78
commit af94d56b56
13 changed files with 20 additions and 23 deletions

View File

@ -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;

View File

@ -46,8 +46,8 @@ static int Execute(llvm::Module *Mod, char * const *envp) {
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, char * const *envp) {
// (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, char * const *envp) {
// 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, char * const *envp) {
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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -106,7 +106,7 @@ class CompilerInstance : public ModuleLoader {
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

View File

@ -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 {

View File

@ -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;

View File

@ -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)

View File

@ -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>

View File

@ -537,7 +537,7 @@ bool MigrationProcess::applyTransform(TransformFn trans,
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();

View File

@ -1631,9 +1631,7 @@ void Sema::WarnExactTypedMethods(ObjCMethodDecl *ImpMethodDecl,
/// 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 &S,
// 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);
}

View File

@ -11685,7 +11685,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
// 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]);