[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
Sun May 5 06:42:55 PDT 2019
dyatkovskiy created this revision.
dyatkovskiy added a project: clang.
Herald added a subscriber: cfe-commits.
This fix adds out of scope member classes definitions support for AST Printer.
Repository:
rC Clang
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
@@ -287,5 +287,21 @@
// PRINT-NEXT: };
};
+#ifdef __cplusplus
+// PRINT-CXX-LABEL: outOfRecordDef
+void outOfRecordDef () {
+ // PRINT-CXX-NEXT: struct DeclEnclosing {
+ struct DeclEnclosing {
+ // PRINT-CXX-NEXT: struct DeclMember;
+ struct DeclMember;
+ // PRINT-CXX-NEXT: };
+ };
+ // PRINT-CXX-NEXT: struct DeclEnclosing::DeclMember {
+ struct DeclEnclosing::DeclMember {
+ // PRINT-CXX-NEXT: };
+ };
+}
+#endif
+
// A tag decl group in the tag decl's own member list is exercised in
// defSelfRef above.
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 (auto *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.198174.patch
Type: text/x-patch
Size: 1267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190505/0c05436c/attachment.bin>
More information about the cfe-commits
mailing list