@@ -292,7 +292,7 @@ enum class ArtificialMainKind : uint8_t {
292292};
293293
294294// / Decl - Base class for all declarations in Swift.
295- class alignas (1 << DeclAlignInBits) Decl {
295+ class alignas (1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
296296protected:
297297 union { uint64_t OpaqueBits;
298298
@@ -1022,19 +1022,6 @@ class alignas(1 << DeclAlignInBits) Decl {
10221022 // / Retrieve the diagnostic engine for diagnostics emission.
10231023 LLVM_READONLY
10241024 DiagnosticEngine &getDiags () const ;
1025-
1026- // Make vanilla new/delete illegal for Decls.
1027- void *operator new (size_t Bytes) = delete ;
1028- void operator delete (void *Data) = delete ;
1029-
1030- // Only allow allocation of Decls using the allocator in ASTContext
1031- // or by doing a placement new.
1032- void *operator new (size_t Bytes, const ASTContext &C,
1033- unsigned Alignment = alignof (Decl));
1034- void *operator new (size_t Bytes, void *Mem) {
1035- assert (Mem);
1036- return Mem;
1037- }
10381025};
10391026
10401027// / Allocates memory for a Decl with the given \p baseSize. If necessary,
@@ -1417,6 +1404,7 @@ class ExtensionDecl final : public GenericContext, public Decl,
14171404 }
14181405
14191406 using DeclContext::operator new ;
1407+ using DeclContext::operator delete ;
14201408};
14211409
14221410// / Iterator that walks the extensions of a particular type.
@@ -1971,6 +1959,7 @@ class TopLevelCodeDecl : public DeclContext, public Decl {
19711959 }
19721960
19731961 using DeclContext::operator new ;
1962+ using DeclContext::operator delete ;
19741963};
19751964
19761965// / SerializedTopLevelCodeDeclContext - This represents what was originally a
@@ -2621,6 +2610,7 @@ class GenericTypeDecl : public GenericContext, public TypeDecl {
26212610 // Resolve ambiguity due to multiple base classes.
26222611 using TypeDecl::getASTContext;
26232612 using DeclContext::operator new ;
2613+ using DeclContext::operator delete ;
26242614 using TypeDecl::getDeclaredInterfaceType;
26252615
26262616 static bool classof (const DeclContext *C) {
@@ -5734,6 +5724,7 @@ class SubscriptDecl : public GenericContext, public AbstractStorageDecl {
57345724 }
57355725
57365726 using DeclContext::operator new ;
5727+ using DeclContext::operator delete ;
57375728 using Decl::getASTContext;
57385729};
57395730
@@ -6282,6 +6273,7 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
62826273 bool hasKnownUnsafeSendableFunctionParams () const ;
62836274
62846275 using DeclContext::operator new ;
6276+ using DeclContext::operator delete ;
62856277 using Decl::getASTContext;
62866278};
62876279
@@ -6813,6 +6805,7 @@ class EnumElementDecl : public DeclContext, public ValueDecl {
68136805 }
68146806
68156807 using DeclContext::operator new ;
6808+ using DeclContext::operator delete ;
68166809 using Decl::getASTContext;
68176810};
68186811
0 commit comments