[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 15:36:41 PDT 2021


yonghong-song added inline comments.


================
Comment at: clang/lib/CodeGen/CGExpr.cpp:2844
+      auto *Fn =
+          dyn_cast<llvm::Function>(LV.getPointer(*this)->stripPointerCasts());
+      if (DI && !Fn->getSubprogram())
----------------
dblaikie wrote:
> Oh, please change this to cast, rather than dyn_cast before committing. (since the Fn is unconditionally dereferenced on the next line (well, conditional on DI, but that's not relevant to this)
> 
> Could also move the "if (DI)" further out, like this:
> ```
> if (CGDebugInfo *DI = ...) {
>   auto *Fn = cast...
>   if (!Fn->getSubprogram())
>     DI->EmitFunctionDecl(...);
> }
> ```
done as suggested!


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