File tree 7 files changed +15
-13
lines changed
7 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -407,7 +407,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
407
407
// / \brief Mapping from each declaration context to its corresponding
408
408
// / mangling numbering context (used for constructs like lambdas which
409
409
// / need to be consistently numbered for the mangler).
410
- llvm::DenseMap<const DeclContext *, MangleNumberingContext * >
410
+ llvm::DenseMap<const DeclContext *, std::unique_ptr< MangleNumberingContext> >
411
411
MangleNumberingContexts;
412
412
413
413
// / \brief Side-table of mangling numbers for declarations which rarely
@@ -2470,7 +2470,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
2470
2470
// / DeclContext.
2471
2471
MangleNumberingContext &getManglingNumberContext (const DeclContext *DC);
2472
2472
2473
- MangleNumberingContext * createMangleNumberingContext () const ;
2473
+ std::unique_ptr< MangleNumberingContext> createMangleNumberingContext () const ;
2474
2474
2475
2475
// / \brief Used by ParmVarDecl to store on the side the
2476
2476
// / index of the parameter when it exceeds the size of the normal bitfield.
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ class VarDecl;
29
29
30
30
// / \brief Keeps track of the mangled names of lambda expressions and block
31
31
// / literals within a particular context.
32
- class MangleNumberingContext : public RefCountedBase <MangleNumberingContext> {
32
+ class MangleNumberingContext {
33
33
public:
34
34
virtual ~MangleNumberingContext () {}
35
35
Original file line number Diff line number Diff line change @@ -876,7 +876,7 @@ class Sema {
876
876
// /
877
877
// / This mangling information is allocated lazily, since most contexts
878
878
// / do not have lambda expressions or block literals.
879
- IntrusiveRefCntPtr <MangleNumberingContext> MangleNumbering;
879
+ std::unique_ptr <MangleNumberingContext> MangleNumbering;
880
880
881
881
// / \brief If we are processing a decltype type, a set of call expressions
882
882
// / for which we have deferred checking the completeness of the return type.
Original file line number Diff line number Diff line change @@ -794,8 +794,6 @@ ASTContext::~ASTContext() {
794
794
795
795
for (const auto &Value : ModuleInitializers)
796
796
Value.second->~PerModuleInitializers();
797
-
798
- llvm::DeleteContainerSeconds(MangleNumberingContexts);
799
797
}
800
798
801
799
void ASTContext::ReleaseParentMapEntries() {
@@ -8982,13 +8980,14 @@ unsigned ASTContext::getStaticLocalNumber(const VarDecl *VD) const {
8982
8980
MangleNumberingContext &
8983
8981
ASTContext::getManglingNumberContext(const DeclContext *DC) {
8984
8982
assert(LangOpts.CPlusPlus); // We don't need mangling numbers for plain C.
8985
- MangleNumberingContext * &MCtx = MangleNumberingContexts[DC];
8983
+ std::unique_ptr< MangleNumberingContext> &MCtx = MangleNumberingContexts[DC];
8986
8984
if (!MCtx)
8987
8985
MCtx = createMangleNumberingContext();
8988
8986
return *MCtx;
8989
8987
}
8990
8988
8991
- MangleNumberingContext *ASTContext::createMangleNumberingContext() const {
8989
+ std::unique_ptr<MangleNumberingContext>
8990
+ ASTContext::createMangleNumberingContext() const {
8992
8991
return ABI->createMangleNumberingContext();
8993
8992
}
8994
8993
Original file line number Diff line number Diff line change @@ -43,7 +43,8 @@ class CXXABI {
43
43
virtual bool isNearlyEmpty (const CXXRecordDecl *RD) const = 0;
44
44
45
45
// / Returns a new mangling number context for this C++ ABI.
46
- virtual MangleNumberingContext *createMangleNumberingContext () const = 0;
46
+ virtual std::unique_ptr<MangleNumberingContext>
47
+ createMangleNumberingContext () const = 0 ;
47
48
48
49
// / Adds a mapping from class to copy constructor for this C++ ABI.
49
50
virtual void addCopyConstructorForExceptionObject (CXXRecordDecl *,
Original file line number Diff line number Diff line change @@ -163,8 +163,9 @@ class ItaniumCXXABI : public CXXABI {
163
163
return nullptr ;
164
164
}
165
165
166
- MangleNumberingContext *createMangleNumberingContext () const override {
167
- return new ItaniumNumberingContext ();
166
+ std::unique_ptr<MangleNumberingContext>
167
+ createMangleNumberingContext () const override {
168
+ return llvm::make_unique<ItaniumNumberingContext>();
168
169
}
169
170
};
170
171
}
Original file line number Diff line number Diff line change @@ -143,8 +143,9 @@ class MicrosoftCXXABI : public CXXABI {
143
143
const_cast <TagDecl *>(TD->getCanonicalDecl ()));
144
144
}
145
145
146
- MangleNumberingContext *createMangleNumberingContext () const override {
147
- return new MicrosoftNumberingContext ();
146
+ std::unique_ptr<MangleNumberingContext>
147
+ createMangleNumberingContext () const override {
148
+ return llvm::make_unique<MicrosoftNumberingContext>();
148
149
}
149
150
};
150
151
}
You can’t perform that action at this time.
0 commit comments