================
@@ -1337,9 +1337,11 @@ static void EmitNewInitializer(CodeGenFunction &CGF,
const CXXNewExpr *E,
static RValue EmitNewDeleteCall(CodeGenFunction &CGF,
const FunctionDecl *CalleeDecl,
const FunctionProtoType *CalleeType,
- const CallArgList &Args) {
+ const CallArgList &Args,
+ llvm::Constant *CalleeOverride = nullptr) {
llvm::CallBase *CallOrInvoke;
- llvm::Constant *CalleePtr = CGF.CGM.GetAddrOfFunction(CalleeDecl);
+ llvm::Constant *CalleePtr =
+ CalleeOverride ? CalleeOverride : CGF.CGM.GetAddrOfFunction(CalleeDecl);
----------------
Fznamznon wrote:
CodeGen usually tries to be smart about functions that are emitted in the
resulting LLVM IR module. If something is never used and there is no way to use
it outside of the current translation unit - it won't be emitted, the simplest
example of that case is unused static function.
I was thinking since we always replace the calls to the operator delete with a
wrapper call, It may happen that we never see the actual (user defined)
operator delete (in my compiler explorer link it is function with
`std::type_identity` argument, its mangling name is
`??3@YAXU?$type_identity@UKernelBase@@@std@@PEAX_KW4align_val_t@1@@Z` in the
LLVM IR) in the codegen as something referenced within the TU and therefore it
might be missing due to CodeGen being too smart about it.
However in my compiler explorer link I see it emitted even though I never
create an object of the class this function intended for and therefore that
example is not good.
https://github.com/llvm/llvm-project/pull/188372
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits