diff options
author | Reid Kleckner <reid@kleckner.net> | 2015-03-19 17:03:58 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2015-03-19 17:03:58 +0000 |
commit | 7270ef5705e36fcad7fdac3529752596abdee74f (patch) | |
tree | 0ab6db2701fa2735710651871c26863434cdc13e /clang/lib/Sema/SemaExprCXX.cpp | |
parent | ca4f699cc2a7b1a3b4b521dc4f7c90673c683f6d (diff) | |
download | bcm5719-llvm-7270ef5705e36fcad7fdac3529752596abdee74f.tar.gz bcm5719-llvm-7270ef5705e36fcad7fdac3529752596abdee74f.zip |
Revert "Improvement on sized deallocation from r230160"
This reverts commit r230580.
extern_weak functions don't appear to work on Darwin (PR22951), so we'll
need to come up with a new approach.
llvm-svn: 232731
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)); |