[PATCH] D106618: [Clang][LLVM] generate btf_tag annotations for DISubprogram types

Yonghong Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 25 22:58:55 PDT 2021


yonghong-song added a comment.

We have

  llvm::DINode::DIFlags CGDebugInfo::getCallSiteRelatedAttrs() const {
    // Call site-related attributes are only useful in optimized programs, and
    // when there's a possibility of debugging backtraces.
    if (!CGM.getLangOpts().Optimize || DebugKind == codegenoptions::NoDebugInfo ||
        DebugKind == codegenoptions::LocTrackingOnly)
      return llvm::DINode::FlagZero;

and `getCallSiteRelatedAttrs()` is used to check whether debuginfo
should be emitted or not by comparing to llvm::DINode::FlagZero,

  // Do not emit a declaration subprogram for a builtin, a function with nodebug
  // attribute, or if call site info isn't required. Also, elide declarations
  // for functions with reserved names, as call site-related features aren't
  // interesting in this case (& also, the compiler may emit calls to these
  // functions without debug locations, which makes the verifier complain).
  if (CalleeDecl->getBuiltinID() != 0 || CalleeDecl->hasAttr<NoDebugAttr>() ||
      getCallSiteRelatedAttrs() == llvm::DINode::FlagZero)
    return;

So looks like as long as the optimization is not on, the condition
`!CGM.getLangOpts().Optimize` will be true and the callsite debuginfo
will not be emitted.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106618



More information about the cfe-commits mailing list