mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 00:39:23 -06:00
This code had some problems: https://github.com/compiler-explorer/compiler-explorer/blob/07d5c3312fce98d2742fa7ed738d4084f3a6975f/lib/demangler/base.ts#L200-L203 There `PrefixTree.replaceAll` replaces mangled to demangled names 'blindly', with no notion of labels. Later `demangleLabels` runs separate logic to update the column-range of each label in hope of mimicking the `replaceAll` action. This fails in some cases: (1) the `demangleLables` code handles only a single occurrence of each label in a line, (2) It also diverges from `replaceAll` in case that a string which is a label-name appears in the line *not* as part of a label (this does happen!). This fix makes `replaceAll` return detailed account of its actions, and then use these to properly adjust the label ranges. This fix might not address all the root issues, but it does make some `label` decisions consistent where they weren't.