[PATCH] D21705: Include debug info for nested structs and classes

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 29 12:49:54 PDT 2016

rnk added inline comments.

Comment at: lib/CodeGen/CGDebugInfo.cpp:1075
@@ +1074,3 @@
+      } else if (const auto *nestedRec = dyn_cast<CXXRecordDecl>(I)) {
+        if (!nestedRec->isImplicit())
+          CollectRecordNestedRecord(nestedRec, elements);
I would add `&& nestedRec->getDeclContext() == record` to this condition to deal with the `struct B { B(struct A*); };` test case.

Comment at: test/CodeGenObjCXX/debug-info-cyclic.mm:11
@@ -10,3 +10,3 @@
 // CHECK-SAME:                             identifier:
-// CHECK: ![[BMEMBERS]] = !{![[BB:[0-9]+]]}
+// CHECK: ![[BMEMBERS]] = !{![[A:[0-9]+]], ![[BB:[0-9]+]]}
   B(struct A *);
This is interesting, this test case shouldn't change. The lexical context for 'struct A' is B, but the semantic context is the surrounding TU. We should only list class members that use the parent class as their DeclContext.

Also, why is this an Obj-C++ test in the first place, it only uses C++...


More information about the cfe-commits mailing list