This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG291eb2589fdc: [clang][DeclPrinter] Fix AST print to suppress output of implicit (non-written)… (authored by strimo378).
Changed prior to commit: https://reviews.llvm.org/D156523?vs=545102&id=547988#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156523/new/ https://reviews.llvm.org/D156523 Files: clang/lib/AST/DeclPrinter.cpp clang/test/AST/ast-print-method-decl.cpp Index: clang/test/AST/ast-print-method-decl.cpp =================================================================== --- clang/test/AST/ast-print-method-decl.cpp +++ clang/test/AST/ast-print-method-decl.cpp @@ -100,3 +100,26 @@ // CHECK-NEXT: }; }; + + +// ---- Check that implict (non-written) constructor initializers are not output + +struct ImplicitCtorInit1 { + int a; +}; + +// CHECK: struct ImplicitCtorInit2 : ImplicitCtorInit1 { +struct ImplicitCtorInit2 : ImplicitCtorInit1 { + + // CHECK-NEXT: ImplicitCtorInit2(int *) { + ImplicitCtorInit2(int *) { + // CHECK-NEXT: } + } + + // CHECK-NEXT: ImplicitCtorInit2(int **) : ImplicitCtorInit1() { + ImplicitCtorInit2(int **) : ImplicitCtorInit1() { + // CHECK-NEXT: } + } + + // CHECK-NEXT: }; +}; Index: clang/lib/AST/DeclPrinter.cpp =================================================================== --- clang/lib/AST/DeclPrinter.cpp +++ clang/lib/AST/DeclPrinter.cpp @@ -309,6 +309,8 @@ for (const auto *BMInitializer : CDecl->inits()) { if (BMInitializer->isInClassMemberInitializer()) continue; + if (!BMInitializer->isWritten()) + continue; if (!HasInitializerList) { Proto += " : ";
Index: clang/test/AST/ast-print-method-decl.cpp =================================================================== --- clang/test/AST/ast-print-method-decl.cpp +++ clang/test/AST/ast-print-method-decl.cpp @@ -100,3 +100,26 @@ // CHECK-NEXT: }; }; + + +// ---- Check that implict (non-written) constructor initializers are not output + +struct ImplicitCtorInit1 { + int a; +}; + +// CHECK: struct ImplicitCtorInit2 : ImplicitCtorInit1 { +struct ImplicitCtorInit2 : ImplicitCtorInit1 { + + // CHECK-NEXT: ImplicitCtorInit2(int *) { + ImplicitCtorInit2(int *) { + // CHECK-NEXT: } + } + + // CHECK-NEXT: ImplicitCtorInit2(int **) : ImplicitCtorInit1() { + ImplicitCtorInit2(int **) : ImplicitCtorInit1() { + // CHECK-NEXT: } + } + + // CHECK-NEXT: }; +}; Index: clang/lib/AST/DeclPrinter.cpp =================================================================== --- clang/lib/AST/DeclPrinter.cpp +++ clang/lib/AST/DeclPrinter.cpp @@ -309,6 +309,8 @@ for (const auto *BMInitializer : CDecl->inits()) { if (BMInitializer->isInClassMemberInitializer()) continue; + if (!BMInitializer->isWritten()) + continue; if (!HasInitializerList) { Proto += " : ";
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits