[PATCH] D61566: Fix for bug 41747: AST Printer doesn't print nested name specifier for out of scope record definitions
Stepan Dyatkovskiy via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 9 01:06:35 PDT 2019
dyatkovskiy updated this revision to Diff 198771.
dyatkovskiy added a comment.
Patch updates per review remarks
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61566/new/
https://reviews.llvm.org/D61566
Files:
clang/lib/AST/DeclPrinter.cpp
clang/test/AST/ast-print-record-decl.c
Index: clang/test/AST/ast-print-record-decl.c
===================================================================
--- clang/test/AST/ast-print-record-decl.c
+++ clang/test/AST/ast-print-record-decl.c
@@ -289,3 +289,21 @@
// A tag decl group in the tag decl's own member list is exercised in
// defSelfRef above.
+
+#ifdef __cplusplus
+// PRINT-CXX-LABEL: outOfRecordDef
+void outOfRecordDef () {
+
+ // PRINT-CXX-NEXT: struct DeclEnclosing {
+ // PRINT-CXX-NEXT: struct DeclMember;
+ // PRINT-CXX-NEXT: };
+ struct DeclEnclosing {
+ struct DeclMember;
+ };
+
+ // PRINT-CXX-NEXT: struct DeclEnclosing::DeclMember {
+ // PRINT-CXX-NEXT: };
+ struct DeclEnclosing::DeclMember {
+ };
+}
+#endif
Index: clang/lib/AST/DeclPrinter.cpp
===================================================================
--- clang/lib/AST/DeclPrinter.cpp
+++ clang/lib/AST/DeclPrinter.cpp
@@ -953,7 +953,12 @@
prettyPrintAttributes(D);
if (D->getIdentifier()) {
- Out << ' ' << *D;
+ Out << ' ';
+
+ if (const NestedNameSpecifier *Q = D->getQualifier())
+ Q->print(Out, Policy);
+
+ Out << *D;
if (auto S = dyn_cast<ClassTemplatePartialSpecializationDecl>(D))
printTemplateArguments(S->getTemplateArgs(), S->getTemplateParameters());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61566.198771.patch
Type: text/x-patch
Size: 1265 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190509/8efc4f26/attachment.bin>
More information about the cfe-commits
mailing list