More mangling issues

Martin von Loewis loewis at informatik.hu-berlin.de
Thu Mar 2 14:38:27 UTC 2000


I just started writing a demangler, and found some more problems with
the mangling spec:

Example 8 should read '_Z1fIiEv'; the return type was missing.

For S<number>_ backward references, the spec does not say what the
relative order of template arguments and the specialization is, but
appears to assume that the arguments follow the specialization. That
seems unnatural: Consider

  N1N1TIiiE2mfE

Demangling would proceed by building up a list of types as they are
seen, so the list would be filled, in order

<open a new nested name>
  Process 1N, put "N" into the list
  Process 1T, put "N::T" into the list
  <open a new template argument list>
     Process i, put "int" into the list
     Process i, put "int" into the list
  <complete template arguments:>
  Combine template and arguments, 
    to get specialization N::T<int,int>, put that into the list
  Process 2mf, getting N::T<int,int>::mf
     - how do we know this is not a type?
<close nested name>

So, after this name is processed, my back-references list would be

S1_ N::T<int,int>
S2_ int
S3_ int
S4_ N::T
S5_ N

Or, more generally, the parts of a composed type preceed the complete
type.

Martin




More information about the cxx-abi-dev mailing list