Commit 78b4c0b8 by Jim Stichnoth

Subzero: Fix the name mangling code's base-36 increment.

SZZZ_ was being incremented to S0000_ instead of S1000_. BUG= https://codereview.chromium.org/385273002/ R=wala@chromium.org Review URL: https://codereview.chromium.org/390533002
parent 217dc082
...@@ -166,9 +166,10 @@ void GlobalContext::incrementSubstitutions(ManglerVector &OldName) const { ...@@ -166,9 +166,10 @@ void GlobalContext::incrementSubstitutions(ManglerVector &OldName) const {
assert(OldName[OldPos - 1] == 'S'); assert(OldName[OldPos - 1] == 'S');
assert(OldName[OldPos + Length] == '_'); assert(OldName[OldPos + Length] == '_');
if (AllZs) { if (AllZs) {
// Replace N 'Z' characters with N+1 '0' characters. (This // Replace N 'Z' characters with a '0' (if N=0) or '1' (if
// is also true for N=0, i.e. S_ ==> S0_ .) // N>0) followed by N '0' characters.
for (size_t i = 0; i < Length + 1; ++i) { NewName[NewPos++] = (Length ? '1' : '0');
for (size_t i = 0; i < Length; ++i) {
NewName[NewPos++] = '0'; NewName[NewPos++] = '0';
} }
} else { } else {
......
...@@ -105,14 +105,14 @@ entry: ...@@ -105,14 +105,14 @@ entry:
; Test for substitution incrementing. This single test captures: ; Test for substitution incrementing. This single test captures:
; S<num>_ ==> S<num+1>_ for single-digit <num> ; S<num>_ ==> S<num+1>_ for single-digit <num>
; S_ ==> S0_ ; S_ ==> S0_
; String length increase, e.g. SZZZ_ ==> S0000_ ; String length increase, e.g. SZZZ_ ==> S1000_
; At least one digit wrapping without length increase, e.g. SZ9ZZ_ ==> SZA00_ ; At least one digit wrapping without length increase, e.g. SZ9ZZ_ ==> SZA00_
; Unrelated identifiers containing S[0-9A-Z]* , e.g. MyClassS1x ; Unrelated identifiers containing S[0-9A-Z]* , e.g. MyClassS1x
; A proper substring of S<num>_ at the end of the string ; A proper substring of S<num>_ at the end of the string
; (to test parser edge cases) ; (to test parser edge cases)
define internal void @_Z3fooP10MyClassS1xP10MyClassS2xRS_RS1_S_S1_SZZZ_SZ9ZZ_S12345() { define internal void @_Z3fooP10MyClassS1xP10MyClassS2xRS_RS1_S_S1_SZZZ_SZ9ZZ_S12345() {
; MANGLE: _ZN7Subzero3fooEP10MyClassS1xP10MyClassS2xRS0_RS2_S0_S2_S0000_SZA00_S12345: ; MANGLE: _ZN7Subzero3fooEP10MyClassS1xP10MyClassS2xRS0_RS2_S0_S2_S1000_SZA00_S12345:
entry: entry:
ret void ret void
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment