Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
support new pascal mangling "Np", keep old mangling "V" temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
rainers committed Apr 15, 2017
1 parent 378615b commit 185cafc
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/core/demangle.d
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,9 @@ private struct Demangle
parseType();
put( ')' );
return dst[beg .. len];
case 'p': // extern(Pascal) function
pos--; // step back to 'N'
return parseTypeFunction( name );
default:
error();
assert( 0 );
Expand Down Expand Up @@ -943,6 +946,11 @@ private struct Demangle
popFront();
put( "extern (Windows) " );
break;
case 'N':
popFront();
if( front != 'p' )
error();
goto case;
case 'V': // Pascal
popFront();
put( "extern (Pascal) " );
Expand Down Expand Up @@ -1873,8 +1881,9 @@ private template isExternCPP(FT) if (is(FT == function))
private template hasPlainMangling(FT) if (is(FT == function))
{
enum c = FT.mangleof[0];
// C || Pascal || Windows
enum hasPlainMangling = c == 'U' || c == 'V' || c == 'W';
enum hasPlainMangling = c == 'U' // C
|| c == 'V' || (c == 'N' && FT.mangleof[1] == 'p') // Pascal (temporarily support old and new mangling)
|| c == 'W'; // Windows
}

unittest
Expand Down

0 comments on commit 185cafc

Please sign in to comment.