diff options
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 7fdb34a7f6e..97ee7bdfcdc 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -2169,6 +2169,15 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, } } + // If the function is sized operator delete and has not already been + // declared, and weak definitions have been disabled, do not declare + // it implicitly. Instead, let deallocation function lookup pick up + // unsized delete. + // FIXME: We should remove this guard once backward compatibility is + // no longer an issue + if (NumParams == 2 && !getLangOpts().DefineSizedDeallocation) + return; + FunctionProtoType::ExtProtoInfo EPI; QualType BadAllocType; @@ -2201,16 +2210,6 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, Alloc->addAttr(VisibilityAttr::CreateImplicit(Context, VisibilityAttr::Default)); - if (NumParams == 2 && !getLangOpts().DefineSizedDeallocation) { - assert(getLangOpts().SizedDeallocation && - "Only sized deallocation can have two parameters"); - - // This declaration should be emited as extern_weak. - assert(Alloc->getLinkageAndVisibility().getLinkage() == - clang::ExternalLinkage); - Alloc->addAttr(WeakAttr::CreateImplicit(Context)); - } - if (AddRestrictAttr) Alloc->addAttr( RestrictAttr::CreateImplicit(Context, RestrictAttr::GNU_malloc)); |