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();
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();
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits