[PATCH] D104777: PR50767: clear non-distinct debuginfo for function with nodebug definition after undecorated declaration

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 23 20:47:41 PDT 2021


dblaikie added a comment.

In D104777#2837347 <https://reviews.llvm.org/D104777#2837347>, @brunodefraine wrote:

> In D104777#2836669 <https://reviews.llvm.org/D104777#2836669>, @dblaikie wrote:
>
>> Yeah, all that sounds reasonable to me - @brunodefraine could you look into supporting nodebug in a similar way as @aaron.ballman has described here?
>
> Since the debuginfo for `use()` is slightly affected by the `nodebug` version of `t1()` that follows it, I can see how this back propagation is perhaps dangerous. Checking that `nodebug` is the same on all declarations of a function is a way to prevent this.
>
> But when discussing the PR, @probinson wrote "I'm inclined to think we want this to work" and I can see what he means from the use case where I observed the bug. If you don't want debuginfo for the implementation of `t1()`, it should be fine to annotate just the function definition in an implementation file, not the declaration in a header, since the debuginfo of the implementation is not of the caller's concern. But `nodebug` as it exists **does** affect the debuginfo of callers as well, so I cannot really express that I don't want debuginfo for the implementation of a function and leave its callers unaffected?

I can see the convenience there, to be sure, being able to put the attribute directly on the function you want to debug - but consistency in how attributes are handled (admitedly this isn't a strong consistency - some are handled this way, some aren't) & consistently seeing the same state for an attribute for a given function seems useful.

@probinson - thoughts?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104777



More information about the cfe-commits mailing list