From 5526f4f094294a7f5c63f80c0fb096ee9dbc3867 Mon Sep 17 00:00:00 2001 From: Larisse Voufo Date: Sat, 14 Feb 2015 05:42:57 +0000 Subject: Revise the implementation logic of sized deallocation: Do not automatically generate weak definitions of the sized operator delete (in terms of unsized operator delete). Instead, provide the funcitonality via a new compiler flag, -fdef-sized-delete. The current implementation causes link-time ODR violations when the delete symbols are exported into the dynamic table. llvm-svn: 229241 --- clang/lib/CodeGen/CodeGenFunction.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp') diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 79425d4..4d03bdb 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -891,8 +891,11 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, } else if (FunctionDecl *UnsizedDealloc = FD->getCorrespondingUnsizedGlobalDeallocationFunction()) { // Global sized deallocation functions get an implicit weak definition if - // they don't have an explicit definition. + // they don't have an explicit definition, if allowed. + assert(getLangOpts().DefaultSizedDelete && + "Can't emit unallowed definition."); EmitSizedDeallocationFunction(*this, UnsizedDealloc); + } else llvm_unreachable("no definition for emitted function"); -- cgit v1.1