Re: [cxx-abi-dev] Mangling sizeof
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cxx-abi-dev] Mangling sizeof
- Subject: Re: [cxx-abi-dev] Mangling sizeof
- From: Jason Merrill <jason@xxxxxxxxxx>
- Date: Thu, 12 Mar 2009 01:45:44 -0400
Jason Merrill wrote:
So, how about a mangling like that for template parms, but starting with
"fp" rather than "T"?
Patch:
*** abi.html.~16~ 2009-01-02 18:17:15.000000000 -0500
--- abi.html 2009-03-12 01:44:29.000000000 -0400
*************** the first of which is lowercase.
*** 3972,3984 ****
::= qu # ?
::= st # sizeof (a type)
::= sz # sizeof (an expression)
::= cv <type> # (cast)
::= v <digit> <source-name> # vendor extended operator
</code></font></a></pre>
<p>
! <a name="mangling-operator">Vendors who define builtin extended operators (e.g. __alignof)
shall encode them as a 'v' prefix followed by
the operand count as a single decimal digit, and
the name in <length,ID> form.
--- 3972,3986 ----
::= qu # ?
::= st # sizeof (a type)
::= sz # sizeof (an expression)
+ ::= at # alignof (a type)
+ ::= az # alignof (an expression)
::= cv <type> # (cast)
::= v <digit> <source-name> # vendor extended operator
</code></font></a></pre>
<p>
! <a name="mangling-operator">Vendors who define builtin extended operators (e.g. __imag)
shall encode them as a 'v' prefix followed by
the operand count as a single decimal digit, and
the name in <length,ID> form.
*************** that is the actual parameter.
*** 4364,4369 ****
--- 4366,4379 ----
</font></code></pre>
<p>
+ Function parameters referenced in a late-specified return type are handled similarly:
+
+ </p><pre><code><font color="blue">
+ <function-param> ::= fp_ # first function parameter
+ ::= fp <<i>parameter-2 non-negative</i> number> _
+ </font></code></pre>
+
+ <p>
Template argument lists appear after the unqualified template name,
and are bracketed by I/E. This is used in names for specializations
in particular, but also in types and scope identification. Template
*************** from other arguments.
*** 4382,4391 ****
::= <<i>binary</i> operator-name> <expression> <expression>
::= <<i>trinary</i> operator-name> <expression> <expression> <expression>
::= cl <expression>* E # call
! ::= st <type> # sizeof
! ::= sT <type> # lvalue of specified type
! ::= sR <type> # rvalue of specified type
::= <template-param>
::= sr <type> <unqualified-name> # dependent name
::= sr <type> <unqualified-name> <template-args> # dependent template-id
::= sZ <template-param> # size of a parameter pack
--- 4392,4403 ----
::= <<i>binary</i> operator-name> <expression> <expression>
::= <<i>trinary</i> operator-name> <expression> <expression> <expression>
::= cl <expression>* E # call
! ::= cv <type> expression # conversion with one argument
! ::= cv <type> _ <expression>* E # conversion with a different number of arguments
! ::= st <type> # sizeof (a type)
! ::= at <type> # alignof (a type)
::= <template-param>
+ ::= <function-param>
::= sr <type> <unqualified-name> # dependent name
::= sr <type> <unqualified-name> <template-args> # dependent template-id
::= sZ <template-param> # size of a parameter pack
*************** are available, the mangling chosen is th
*** 4469,4522 ****
version.
</p>
- <p>
- The <code>sT</code> and <code>sR</code> forms are used within the
- C++0x <code>decltype</code> forms <code>DT</code> and <code>Dt</code>.
- Within these contexts, the value of the expression doesn't matter, only the
- type, so we just mangle the type of the expression directly as an
- expression stub in some cases. This is done for all non-type-dependent
- expressions, and the following forms of type-dependent expressions, for
- which the type can always be described other than in terms of the
- expression even if it is dependent, and therefore is said to
- have <i>describable type</i>:
- </p>
-
- <ul>
- <li>An expression that names a variable, function, function parameter,
- enumerator, data member or template non-type parameter from an enclosing
- function or the current instantiation.</li>
- <li>A cast (C-style, functional or *_cast).</li>
- <li>A literal.</li>
- <li>A new-expression.</li>
- <li>A unary <code>*</code> expression where the operand has describable type.</li>
- </ul>
-
- <p>A variable or new-expression which uses the
- <code>auto</code> type specifier has describable type if and only if its
- initializer is an expression with describable type.
- </p>
-
- <p>
- If the expression is an lvalue, the <code>sT</code> mangling is used;
- otherwise the <code>sR</code> mangling. If the immediate operand
- of <code>decltype</code> has describable type, the type is mangled directly,
- omitting the decltype and expression type stub manglings.
- </p>
-
- <p>
- <img src="abi_files/warning.gif" alt="<b>Rationale</b>:">
- <i>
- Note that this convention means that
- </i></p><pre><i> template <class T> decltype (*(T*)0 + *(T*)0) f(T t);
- </i></pre>
- <i> and
- </i><pre><i> template <class T> auto f(T t) -> decltype (t + t);
- </i></pre>
- <i> have the same mangling, so library maintainers can switch to or from using
- a late-specified return type without affecting the library ABI.
- </i>
-
-
<a name="mangling-scope">
</a><h4><a name="mangling-scope"> 5.1.6 Scope Encoding </a></h4>
--- 4481,4486 ----
*************** unwind table location.
*** 5005,5010 ****
--- 4969,4978 ----
significance should be attached to the form of the revision number; it
is simply a identifying number.</a></p>
+ <p><a name="revisions"><font color="blue">[090312]</font>
+ Remove type stub expressions. Add mangling for alignof, function parameters,
+ and a different mangling for N-argument function casts.</a></p>
+
<p><a name="revisions"><font color="blue">[090102]</font>
Remove mangling for N-argument functional casts.</a></p>