dblaikie added a subscriber: rsmith.
dblaikie added a comment.

In D68117#1714091 <https://reviews.llvm.org/D68117#1714091>, @SouraVX wrote:

> Hi @probinson @dblaikie  @aprantl , I've was investigating and working on 
> your inputs regarding the problem with DW_at_defaulted once. I think clang 
> has also some issues.


You think clang has bugs, independent of the debug info?

>   Though I'm not able to precisely point out. I ranned into some problems in 
> CFE while marking out_of_class functions. i.e consider this for instance 
> "debug-info-defaulted-out_of_class.cpp" FIXME:.  Causing too much trouble and 
> possibly can introduce some bugs in clang/llvm. 
> 
> May be we'll reconsider this in future. Thanks for putting time in reviewing 
> and discussing this.

Yeah, I looked at it a bit & asked @rsmith for some thoughts. Eventually 
wrapped my head around it.

Clang's codegen occurs during parsing - rather than parsing/AST building 
entirely, then code generating. So to take a smaller example:

  struct foo {
    foo();
    // virtual
    void f1();
    void f2();
  };
  void foo::f2() { }
  foo::foo() = default;

Without the virtual keyword, the first time the debug info needs the type (when 
building the description for f1's definition's "this" parameter) the foo::foo() 
= default definition hasn't been parsed yet, so there is no definition of 
foo::foo() available. (so the out of class defaulting isn't visible)

The reason virtual matters is that the actual class definition of 'foo' is 
never built - check the DWARF and metadata, only a declaration of "foo" is 
built. And the declarations of the member functions are injected into the 
declaration as the definitions are parsed, not before - so they observe the 
correct defaulting state.

Another way to show the bug is with -fstandalone-debug, even with a virtual 
function it shows the problem.

And moving 'f2' around (before/after 'foo()') also shows the problem - because 
having f2 first means the type definition (without virtual, or while using 
-fstandalone-debug) is built before any defaulting is seen - so 'foo()' isn't 
shown as defaulted.

All of this somewhat goes to my point - out of line defaulting should be tested 
and recorded on the out of line definition, not on the declaration, of a 
special member.

> Anyway here's the next course of action I'm considering. I'll be marking this 
> review as abandoned. I'll raise a fresh new review for DW_AT_deleted feature, 
> that;s pretty straight forward, considering C++ spec. If it's deleted, it has 
> to be declared/defined{whatever} deleted in it's first declaration. This 
> feature also augments the consumer information regarding which spl member 
> functions are deleted, hence restrict their calling for user or do something 
> useful with this at it's disposal.
> 
> @probinson @dblaikie @aprantl Please share your thoughts/comments inclination 
> regarding adding this DW_AT_deleted to clang/llvm.

Sure, deleted support seems fine/reasonable/good to me.


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

https://reviews.llvm.org/D68117



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to