diff --git a/clang/lib/Frontend/DeclXML.cpp b/clang/lib/Frontend/DeclXML.cpp index 97a7f5558392..3b600ffd2f41 100644 --- a/clang/lib/Frontend/DeclXML.cpp +++ b/clang/lib/Frontend/DeclXML.cpp @@ -43,6 +43,18 @@ class DocumentXML::DeclPrinter : public DeclVisitor { Visit(*i); Doc.toParent(); } + + for (RecordDecl::decl_iterator i = RD->decls_begin(), + e = RD->decls_end(); i != e; ++i) { + Decl *d = *i; + if (isa(d)) { + RecordDecl* pRec = cast(d); + if (pRec->isDefinition()) { + Visit(pRec); + Doc.toParent(); + } + } + } } void addSubNodes(CXXRecordDecl* RD) { diff --git a/clang/test/Coverage/c-language-features.inc b/clang/test/Coverage/c-language-features.inc index 3548132500f9..0ff1237b12e8 100644 --- a/clang/test/Coverage/c-language-features.inc +++ b/clang/test/Coverage/c-language-features.inc @@ -188,3 +188,11 @@ void f10() { x = (struct f10_s0) { .iv0 = "name" }; } + +// Nested structures. +struct s11 { + struct s11_2 { + int f0; + } f0; + int f1; +};