[PATCH] D151528: [clang][DeclPrinter] Fix AST print of out-of-line record definitions
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 7 07:58:20 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2878282dc550: [clang][DeclPrinter] Fix AST print of out-of-line record definitions (authored by strimo378, committed by aaron.ballman).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151528/new/
https://reviews.llvm.org/D151528
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,19 @@
// A tag decl group in the tag decl's own member list is exercised in
// defSelfRef above.
+
+
+// Check out-of-line record definition
+#ifdef __cplusplus
+// PRINT-CXX-NEXT: [[KW]] OutOfLineRecord {
+KW OutOfLineRecord {
+ // PRINT-CXX-NEXT: [[KW]] Inner
+ KW Inner;
+ // PRINT-CXX-NEXT: };
+};
+
+// PRINT-CXX-NEXT: [[KW]] OutOfLineRecord::Inner {
+KW OutOfLineRecord::Inner {
+ // PRINT-CXX-NEXT: };
+};
+#endif
Index: clang/lib/AST/DeclPrinter.cpp
===================================================================
--- clang/lib/AST/DeclPrinter.cpp
+++ clang/lib/AST/DeclPrinter.cpp
@@ -997,7 +997,10 @@
prettyPrintAttributes(D);
if (D->getIdentifier()) {
- Out << ' ' << *D;
+ Out << ' ';
+ if (auto *NNS = D->getQualifier())
+ NNS->print(Out, Policy);
+ Out << *D;
if (auto S = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
ArrayRef<TemplateArgument> Args = S->getTemplateArgs().asArray();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151528.529303.patch
Type: text/x-patch
Size: 1167 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230607/039b0444/attachment-0001.bin>
More information about the cfe-commits
mailing list