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

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 26 14:30:48 PDT 2021


dblaikie 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())
----------------
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(...);
}
```


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