================
@@ -27,6 +27,39 @@ struct E {
   constexpr E(){};
 } TestE;
 
+// Defined delegating constructor where delegated constructor is not defined
+// should not emit full debug info.
+// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: 
"Delegating"{{.*}}flags: DIFlagFwdDecl
+struct Delegating {
+  Delegating() : Delegating(42) {}
+  Delegating(int);
+} TestDelegating;
+
+// Defined delegating constructor where delegated constructor is defined should
+// emit full debug info.
+// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: 
"DelegatingToDefined"{{.*}}DIFlagTypePassByValue
+struct DelegatingToDefined {
+  DelegatingToDefined() : DelegatingToDefined(42) {}
+  DelegatingToDefined(int) {}
+} TestDelegatingToDefined;
+
+// Defined out-of-line delegating constructor where delegated constructor is
+// defined should emit full debug info.
+// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: 
"DelegatingOutOfLine"{{.*}}DIFlagTypePassByValue
+struct DelegatingOutOfLine {
+  DelegatingOutOfLine();
+  DelegatingOutOfLine(int) {}
+};
+DelegatingOutOfLine d;
+DelegatingOutOfLine::DelegatingOutOfLine() : DelegatingOutOfLine(42) {}
----------------
ClaytonKnittel wrote:

Yep, the tests should already cover these cases I believe.

It essentially boils down to this - all delegating constructors are ignored. 
Otherwise, the normal rules apply for constructor homing.

`DelegatingToOutOfLine` has a delegating ctor that calls another ctor which is 
defined out-of-line. Full debug info is emitted because, ignoring the 
delegating ctor, we can see the definition of a ctor.

And `DelegatingOutOfLine` has a defined out-of-line delegating ctor that calls 
an inline-defined ctor. Also emit full debug info. This is the same as the 
previous test, we just switched which ctors were defined inline vs. out-of-line.

`Delegating` is the only test case that doesn't emit full debug info. It has a 
delegating ctor that calls a ctor which is not defined. It does not emit full 
debug info, which is what we expected.

Let me know if there are any more cases you'd like to test. We have coverage of 
delegating-to-declared (`Delegating`) and delegating-to-defined (all other 
cases), with some combinations of defining ctors inline vs out-of-line (which 
shouldn't make a difference on whether full debug info is emitted).

https://github.com/llvm/llvm-project/pull/218807
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to