Skip to content

Commit af94d56

Browse files
committed
[C++11] Remove the remaining uses of OwningPtr.
Replace OwningArrayPtr with std::unique_ptr<T[]>. llvm-svn: 203388
1 parent f9d26f1 commit af94d56

File tree

13 files changed

+20
-23
lines changed

13 files changed

+20
-23
lines changed

clang/examples/analyzer-plugin/MainCallChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ using namespace ento;
88

99
namespace {
1010
class MainCallChecker : public Checker < check::PreStmt<CallExpr> > {
11-
mutable OwningPtr<BugType> BT;
11+
mutable std::unique_ptr<BugType> BT;
1212

1313
public:
1414
void checkPreStmt(const CallExpr *CE, CheckerContext &C) const;

clang/examples/clang-interpreter/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ static int Execute(llvm::Module *Mod, char * const *envp) {
4646
llvm::InitializeNativeTarget();
4747

4848
std::string Error;
49-
OwningPtr<llvm::ExecutionEngine> EE(
50-
llvm::ExecutionEngine::createJIT(Mod, &Error));
49+
std::unique_ptr<llvm::ExecutionEngine> EE(
50+
llvm::ExecutionEngine::createJIT(Mod, &Error));
5151
if (!EE) {
5252
llvm::errs() << "unable to make execution engine: " << Error << "\n";
5353
return 255;
@@ -83,7 +83,7 @@ int main(int argc, const char **argv, char * const *envp) {
8383
// (basically, exactly one input, and the operation mode is hard wired).
8484
SmallVector<const char *, 16> Args(argv, argv + argc);
8585
Args.push_back("-fsyntax-only");
86-
OwningPtr<Compilation> C(TheDriver.BuildCompilation(Args));
86+
std::unique_ptr<Compilation> C(TheDriver.BuildCompilation(Args));
8787
if (!C)
8888
return 0;
8989

@@ -108,7 +108,7 @@ int main(int argc, const char **argv, char * const *envp) {
108108

109109
// Initialize a compiler invocation object from the clang (-cc1) arguments.
110110
const driver::ArgStringList &CCArgs = Cmd->getArguments();
111-
OwningPtr<CompilerInvocation> CI(new CompilerInvocation);
111+
std::unique_ptr<CompilerInvocation> CI(new CompilerInvocation);
112112
CompilerInvocation::CreateFromArgs(*CI,
113113
const_cast<const char **>(CCArgs.data()),
114114
const_cast<const char **>(CCArgs.data()) +
@@ -140,7 +140,7 @@ int main(int argc, const char **argv, char * const *envp) {
140140
CompilerInvocation::GetResourcesPath(argv[0], MainAddr);
141141

142142
// Create and execute the frontend to generate an LLVM bitcode module.
143-
OwningPtr<CodeGenAction> Act(new EmitLLVMOnlyAction());
143+
std::unique_ptr<CodeGenAction> Act(new EmitLLVMOnlyAction());
144144
if (!Clang.ExecuteAction(*Act))
145145
return 1;
146146

clang/include/clang/ARCMigrate/FileRemapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313
#include "clang/Basic/LLVM.h"
1414
#include "llvm/ADT/DenseMap.h"
15-
#include "llvm/ADT/OwningPtr.h"
1615
#include "llvm/ADT/PointerUnion.h"
1716
#include "llvm/ADT/StringRef.h"
17+
#include <memory>
1818

1919
namespace llvm {
2020
class MemoryBuffer;

clang/include/clang/AST/VTableBuilder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,11 @@ class VTableLayout {
209209
typedef llvm::DenseMap<BaseSubobject, uint64_t> AddressPointsMapTy;
210210
private:
211211
uint64_t NumVTableComponents;
212-
llvm::OwningArrayPtr<VTableComponent> VTableComponents;
212+
std::unique_ptr<VTableComponent[]> VTableComponents;
213213

214214
/// \brief Contains thunks needed by vtables, sorted by indices.
215215
uint64_t NumVTableThunks;
216-
llvm::OwningArrayPtr<VTableThunkTy> VTableThunks;
216+
std::unique_ptr<VTableThunkTy[]> VTableThunks;
217217

218218
/// \brief Address points for all vtables.
219219
AddressPointsMapTy AddressPoints;

clang/include/clang/Basic/LLVM.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ namespace llvm {
2929
class StringRef;
3030
class Twine;
3131
template<typename T> class ArrayRef;
32-
template<typename T> class OwningPtr;
3332
template<unsigned InternalLen> class SmallString;
3433
template<typename T, unsigned N> class SmallVector;
3534
template<typename T> class SmallVectorImpl;
@@ -63,7 +62,6 @@ namespace clang {
6362
using llvm::StringRef;
6463
using llvm::Twine;
6564
using llvm::ArrayRef;
66-
using llvm::OwningPtr;
6765
using llvm::SmallString;
6866
using llvm::SmallVector;
6967
using llvm::SmallVectorImpl;

clang/include/clang/Frontend/CompilerInstance.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class CompilerInstance : public ModuleLoader {
106106
IntrusiveRefCntPtr<ASTReader> ModuleManager;
107107

108108
/// \brief The dependency file generator.
109-
OwningPtr<DependencyFileGenerator> TheDependencyFileGenerator;
109+
std::unique_ptr<DependencyFileGenerator> TheDependencyFileGenerator;
110110

111111
/// \brief The set of top-level modules that has already been loaded,
112112
/// along with the module map

clang/include/clang/Frontend/MultiplexConsumer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#include "clang/Basic/LLVM.h"
1919
#include "clang/Sema/SemaConsumer.h"
20-
#include "llvm/ADT/OwningPtr.h"
20+
#include <memory>
2121
#include <vector>
2222

2323
namespace clang {

clang/include/clang/Rewrite/Core/TokenRewriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
#include "clang/Basic/SourceLocation.h"
1919
#include "clang/Lex/Token.h"
20-
#include "llvm/ADT/OwningPtr.h"
2120
#include <list>
2221
#include <map>
22+
#include <memory>
2323

2424
namespace clang {
2525
class LangOptions;

clang/include/clang/Serialization/ASTReader.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,9 @@ class ASTReaderListener {
188188

189189
/// \brief Simple wrapper class for chaining listeners.
190190
class ChainedASTReaderListener : public ASTReaderListener {
191-
OwningPtr<ASTReaderListener> First;
192-
OwningPtr<ASTReaderListener> Second;
191+
std::unique_ptr<ASTReaderListener> First;
192+
std::unique_ptr<ASTReaderListener> Second;
193+
193194
public:
194195
/// Takes ownership of \p First and \p Second.
195196
ChainedASTReaderListener(ASTReaderListener *First, ASTReaderListener *Second)

clang/include/clang/Tooling/FileMatchTrie.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#define LLVM_CLANG_TOOLING_FILE_MATCH_TRIE_H
1717

1818
#include "clang/Basic/LLVM.h"
19-
#include "llvm/ADT/OwningPtr.h"
2019
#include "llvm/ADT/StringRef.h"
20+
#include <memory>
2121
#include <string>
2222
#include <vector>
2323

0 commit comments

Comments
 (0)