[PATCH] D100567: BPF: emit debuginfo for Function of DeclRefExpr if requested

Yonghong Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 26 14:11:01 PDT 2021


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



More information about the cfe-commits mailing list