r283102 - Fix PR 28885: Fix AST Printer output for the inherited constructor using

Alex L via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 05:23:02 PDT 2016


On 3 October 2016 at 13:12, Alex Lorenz via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: arphaman
> Date: Mon Oct  3 07:12:03 2016
> New Revision: 283102
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283102&view=rev
> Log:
> Fix PR 28885: Fix AST Printer output for the inherited constructor using
> declarations.
>
> This commit ensures that the correct record type is printed out for the
> using declarations that represent C++ inherited constructors.
> It fixes a regression introduced in r274049 which changed the name that's
> stored in the using declarations that correspond to inherited constructors.
>
> Differential Revision: https://reviews.llvm.org/D25131


This was meant to be D25113, I'll revert and recommit.
Sorry about that,
Alex


>
>
> Modified:
>     cfe/trunk/lib/AST/DeclPrinter.cpp
>     cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
>
> Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/
> DeclPrinter.cpp?rev=283102&r1=283101&r2=283102&view=diff
> ============================================================
> ==================
> --- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
> +++ cfe/trunk/lib/AST/DeclPrinter.cpp Mon Oct  3 07:12:03 2016
> @@ -1346,6 +1346,17 @@ void DeclPrinter::VisitUsingDecl(UsingDe
>    if (D->hasTypename())
>      Out << "typename ";
>    D->getQualifier()->print(Out, Policy);
> +
> +  // Use the correct record name when the using declaration is used for
> +  // inheriting constructors.
> +  for (const auto *Shadow : D->shadows()) {
> +    if (const auto *ConstructorShadow =
> +            dyn_cast<ConstructorUsingShadowDecl>(Shadow)) {
> +      assert(Shadow->getDeclContext() == ConstructorShadow->
> getDeclContext());
> +      Out << *ConstructorShadow->getNominatedBaseClass();
> +      return;
> +    }
> +  }
>    Out << *D;
>  }
>
>
> Modified: cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> SemaCXX/cxx11-ast-print.cpp?rev=283102&r1=283101&r2=283102&view=diff
> ============================================================
> ==================
> --- cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp (original)
> +++ cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp Mon Oct  3 07:12:03 2016
> @@ -43,6 +43,14 @@ template <class C, C...> const char *ope
>  // CHECK: const char *PR23120 = operator""_suffix<char32_t, 66615>();
>  const char *PR23120 = U"ð  ·"_suffix;
>
> +// PR28885
> +struct A {
> +  A();
> +};
> +struct B : A {
> +  using A::A; // CHECK:      using A::A;
> +};            // CHECK-NEXT: };
> +
>  // CHECK: ;
>  ;
>  // CHECK-NOT: ;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161003/e910cfeb/attachment.html>


More information about the cfe-commits mailing list