r205943 - AST: Implement proposal for dependent elaborated type specifiers

David Majnemer david.majnemer at gmail.com
Thu Apr 10 11:23:38 PDT 2014


There was a follow-on commit, r205945, which addressed this.

On Thursday, April 10, 2014, Sean Silva <chisophugis at gmail.com> wrote:

> I'm seeing some non-ascii chars in:
>
> +  // Proposal by cxx-abi-dev, 2014-03-26
> +  // <class-enum-type> ::= <name>    # non-dependent or dependent type
> name or
> +  //                                 # dependent elaborated type
> specifier using
> +  //                                 # â EURO ~typename'
> +  //                   ::= Ts <name> # dependent elaborated type
> specifier using
> +  //                                 # â EURO ~structâ EURO (tm) or â EURO ~class'
> +  //                   ::= Tu <name> # dependent elaborated type
> specifier using
> +  //                                 # â EURO ~union'
> +  //                   ::= Te <name> # dependent elaborated type
> specifier using
> +  //                                 # â EURO ~enumâ EURO (tm)
>
>
> On Wed, Apr 9, 2014 at 8:49 PM, David Majnemer <david.majnemer at gmail.com>wrote:
>
> Author: majnemer
> Date: Wed Apr  9 19:49:24 2014
> New Revision: 205943
>
> URL: http://llvm.org/viewvc/llvm-project?rev=205943&view=rev
> Log:
> AST: Implement proposal for dependent elaborated type specifiers
>
> cxx-abi-dev came up with a way to disambiguate between different
> keywords used in elaborated type specifiers.
>
> This resolves certain collisions during mangling.
>
> Modified:
>     cfe/trunk/lib/AST/ItaniumMangle.cpp
>     cfe/trunk/test/CodeGenCXX/mangle.cpp
>
> Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=205943&r1=205942&r2=205943&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
> +++ cfe/trunk/lib/AST/ItaniumMangle.cpp Wed Apr  9 19:49:24 2014
> @@ -2361,8 +2361,35 @@ void CXXNameMangler::mangleType(const Te
>  void CXXNameMangler::mangleType(const DependentNameType *T) {
>    // Typename types are always nested
>    Out << 'N';
> +  // Proposal by cxx-abi-dev, 2014-03-26
> +  // <class-enum-type> ::= <name>    # non-dependent or dependent type
> name or
> +  //                                 # dependent elaborated type
> specifier using
> +  //                                 # â EURO ~typename'
> +  //                   ::= Ts <name> # dependent elaborated type
> specifier using
> +  //                                 # â EURO ~structâ EURO (tm) or â EURO ~class'
> +  //                   ::= Tu <name> # dependent elaborated type
> specifier using
> +  //                                 # â EURO ~union'
> +  //                   ::= Te <name> # dependent elaborated type
> specifier using
> +  //                                 # â EURO ~enumâ EURO (tm)
> +  switch (T->getKeyword()) {
> +    case ETK_Typename:
> +      break;
> +    case ETK_Struct:
> +    case ETK_Class:
> +    case ETK_Interface:
> +      Out << "Ts";
> +      break;
> +    case ETK_Union:
> +      Out << "Tu";
> +      break;
> +    case ETK_Enum:
> +      Out << "Te";
> +      break;
> +    default:
> +      llvm_unreachable("unexpected keyword for dependent type name");
> +  }
>    manglePrefix(T->getQualifier());
> -  mangleSourceName(T->getIdentifier());
> +  mangleSourceName(T->getIdentifier());
>    Out << 'E';
>  }
>
>
> Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=205943&r1=205942&r2=205943&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/mangle.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/mangle.cpp Wed Apr  9 19:49:24 2014
> @@ -951,3 +951,43 @@ namespace test44 {
>    }
>    // CHECK-LABEL: define linkonce_odr void
> @_ZN6test443foo3barEv(%"struct.test44::foo"* %this)
>  }
> +
> +namespace test45 {
> +  struct S {
> +    enum e {};
> +  };
> +  template <typename T>
> +  void f(enum T::e *) {}
> +  template void f<S>(S::e *);
> +  // CHECK-LABEL: define weak_odr void
> @_ZN6test451fINS_1SEEEvPNTeT_1eE(i32*)
> +}
> +
> +namespace test46 {
> +  struct S {
> +    struct s {};
> +  };
> +  template <typename T>
> +  void f(struct T::s *) {}
> +  template void f<S>(S::s *);
> +  // CHECK-LABEL: define weak_odr void
> @_ZN6test461fINS_1SEEEvPNTsT_1sE(%"struct.test46::S::s"*)
> +}
> +
> +namespace test47 {
> +  struct S {
> +    class c {};
> +  };
> +  template <typename T>
> +  void f(class T::c *) {}
> +  template void f<S>(S::c *);
> +  // CHECK-LABEL: define weak_odr void
> @_ZN6test471fINS_1SEEEvPNTsT_1cE(%"class.test47::S::c"*)
> +}
> +
> +namespace test48 {
> +  struct S {
> +    union u {};
> +  };
> +  template <typename T>
> +  void f(union T::u *) {}
> +  template void f<S>(S::
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140410/9ef586a3/attachment.html>


More information about the cfe-commits mailing list