diff options
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 5 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 8 |
2 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 79425d4c21e..4d03bdb8ef4 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"); diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index bc52028a064..fdcbe2a42e8 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1615,13 +1615,13 @@ CodeGenModule::GetOrCreateLLVMFunction(StringRef MangledName, // don't need it anymore). addDeferredDeclToEmit(F, DDI->second); DeferredDecls.erase(DDI); - + // Otherwise, if this is a sized deallocation function, emit a weak - // definition - // for it at the end of the translation unit. + // definition for it at the end of the translation unit. } else if (D && cast<FunctionDecl>(D) ->getCorrespondingUnsizedGlobalDeallocationFunction()) { - addDeferredDeclToEmit(F, GD); + if (getLangOpts().DefaultSizedDelete) + addDeferredDeclToEmit(F, GD); // Otherwise, there are cases we have to worry about where we're // using a declaration for which we must emit a definition but where |