[PATCH] D152017: [DebugInfo] Add flag to only emit referenced member functions

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 6 14:08:31 PDT 2023


dblaikie added a comment.

In D152017#4400735 <https://reviews.llvm.org/D152017#4400735>, @probinson wrote:

> Oh, `-fstandalone-debug` should override this? In the Sony implementation, it does. (Sorry for not remembering that sooner.)

I'd think of this as orthogonal to that, potentially. by analogy with non-member functions. Even in standalone debug, we wouldn't emit a declaration for every function declared in a translation unit. Ah, because we include the mangled names on member function declarations, having that would still allow you to call the function from another translation unit, if it's available, even without DWARF for that TU, I suppose.

So, while it's inconsistent with non-member functions, which doesn't seem like a good principle - yeah, guess we could imply this option is disabled by `-fstandalone-debug`...

In D152017#4400449 <https://reviews.llvm.org/D152017#4400449>, @rnk wrote:

> I tend to think that enabled-by-default options which have names that you are supposed to prefix with no are awkward[1], but the compiler ecosystem (GCC & Clang) has lots of those, and perhaps we should lean into it. I like `-g[no-]undefined-methods` the best of Paul's suggestions.
>
> [1]  `-fdelete-null-pointer-checks`, anyone? Yes, that's a feature I want in my compiler, please delete my null checks, I didn't need those, sign me up!

Yeah, mixed feelings about a default-on flag, so you have to use `-gno-*`. Though one name in that form, might be `-gno-canonical-types`.
(pedantically C++ calls these things "member functions" (& it seems nice to use consistent naming) rather than "methods", but `-g[no-]undefined-member-functions` would be a bit of a mouthful... )


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152017



More information about the cfe-commits mailing list