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

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 15 15:14:48 PDT 2021


dblaikie added a comment.

What happens for this program:

  extern void f1();
  void f2(void *);
  inline void f3() {
    f2(f1);
  }
  ...

Even when `f3` is never called, I'm guessing your change will cause `f1` to be emitted?

Also something like this:

  void f1();
  int main() {
    int x = sizeof(&f1);
  }

Does that produce the declaration of `f1` too?



================
Comment at: clang/lib/CodeGen/CGExpr.cpp:2840
+    // Emit debuginfo for the function declaration if the target wants to.
+    if (getContext().getTargetInfo().allowDebugInfoForExternalVar()) {
+      CGDebugInfo *DI = CGM.getModuleDebugInfo();
----------------
Seems like this should be renamed given it's being used for things other than external variables?


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