diff options
author | Justin Lebar <jlebar@google.com> | 2016-10-10 16:26:19 +0000 |
---|---|---|
committer | Justin Lebar <jlebar@google.com> | 2016-10-10 16:26:19 +0000 |
commit | 20ebffc99abcdb0294c4c7b70777070402d2039b (patch) | |
tree | b7eba494864f74e73c3f9fd251f8bfd70d7e5cb5 /clang/lib | |
parent | 611c5c225a4878fed90add07c112a577954f8ba5 (diff) | |
download | bcm5719-llvm-20ebffc99abcdb0294c4c7b70777070402d2039b.tar.gz bcm5719-llvm-20ebffc99abcdb0294c4c7b70777070402d2039b.zip |
[AST] Convert MangleNumberingContext to a unique_ptr.
Summary: It doesn't need to be refcounted anymore, either.
Reviewers: timshen
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25420
llvm-svn: 283768
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 7 | ||||
-rw-r--r-- | clang/lib/AST/CXXABI.h | 3 | ||||
-rw-r--r-- | clang/lib/AST/ItaniumCXXABI.cpp | 5 | ||||
-rw-r--r-- | clang/lib/AST/MicrosoftCXXABI.cpp | 5 |
4 files changed, 11 insertions, 9 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index dc99d4dabd4..08677474779 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -794,8 +794,6 @@ ASTContext::~ASTContext() { for (const auto &Value : ModuleInitializers) Value.second->~PerModuleInitializers(); - - llvm::DeleteContainerSeconds(MangleNumberingContexts); } void ASTContext::ReleaseParentMapEntries() { @@ -8982,13 +8980,14 @@ unsigned ASTContext::getStaticLocalNumber(const VarDecl *VD) const { MangleNumberingContext & ASTContext::getManglingNumberContext(const DeclContext *DC) { assert(LangOpts.CPlusPlus); // We don't need mangling numbers for plain C. - MangleNumberingContext *&MCtx = MangleNumberingContexts[DC]; + std::unique_ptr<MangleNumberingContext> &MCtx = MangleNumberingContexts[DC]; if (!MCtx) MCtx = createMangleNumberingContext(); return *MCtx; } -MangleNumberingContext *ASTContext::createMangleNumberingContext() const { +std::unique_ptr<MangleNumberingContext> +ASTContext::createMangleNumberingContext() const { return ABI->createMangleNumberingContext(); } diff --git a/clang/lib/AST/CXXABI.h b/clang/lib/AST/CXXABI.h index c23b9191c7a..e1cf934ee0b 100644 --- a/clang/lib/AST/CXXABI.h +++ b/clang/lib/AST/CXXABI.h @@ -43,7 +43,8 @@ public: virtual bool isNearlyEmpty(const CXXRecordDecl *RD) const = 0; /// Returns a new mangling number context for this C++ ABI. - virtual MangleNumberingContext *createMangleNumberingContext() const = 0; + virtual std::unique_ptr<MangleNumberingContext> + createMangleNumberingContext() const = 0; /// Adds a mapping from class to copy constructor for this C++ ABI. virtual void addCopyConstructorForExceptionObject(CXXRecordDecl *, diff --git a/clang/lib/AST/ItaniumCXXABI.cpp b/clang/lib/AST/ItaniumCXXABI.cpp index 8a2cc0fbee4..482c3c5d338 100644 --- a/clang/lib/AST/ItaniumCXXABI.cpp +++ b/clang/lib/AST/ItaniumCXXABI.cpp @@ -163,8 +163,9 @@ public: return nullptr; } - MangleNumberingContext *createMangleNumberingContext() const override { - return new ItaniumNumberingContext(); + std::unique_ptr<MangleNumberingContext> + createMangleNumberingContext() const override { + return llvm::make_unique<ItaniumNumberingContext>(); } }; } diff --git a/clang/lib/AST/MicrosoftCXXABI.cpp b/clang/lib/AST/MicrosoftCXXABI.cpp index 3ae04538d62..bb59fba5eec 100644 --- a/clang/lib/AST/MicrosoftCXXABI.cpp +++ b/clang/lib/AST/MicrosoftCXXABI.cpp @@ -143,8 +143,9 @@ public: const_cast<TagDecl *>(TD->getCanonicalDecl())); } - MangleNumberingContext *createMangleNumberingContext() const override { - return new MicrosoftNumberingContext(); + std::unique_ptr<MangleNumberingContext> + createMangleNumberingContext() const override { + return llvm::make_unique<MicrosoftNumberingContext>(); } }; } |