yonghong-song added a comment.

Looks like stripPointerCasts() is enough to make it work (no null Function 
pointer any more). This is consistent with

  llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction(
      StringRef MangledName, llvm::Type *Ty, GlobalDecl GD, bool ForVTable,
      bool DontDefer, bool IsThunk, llvm::AttributeList ExtraAttrs,
      ForDefinition_t IsForDefinition) {
    const Decl *D = GD.getDecl();
  ...
    // Make sure the result is of the requested type.
    if (!IsIncompleteFunction) {
      assert(F->getFunctionType() == Ty);
      return F;
    } 
  
    llvm::Type *PTy = llvm::PointerType::getUnqual(Ty);
    return llvm::ConstantExpr::getBitCast(F, PTy);
  }

It either returns a Function, or a Function-Casting-To-ConstantExpr.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100567/new/

https://reviews.llvm.org/D100567

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to