Preserving order for `-fdebug-prefix-map`, `-fcoverage-prefix-map`, and `-fmacro-prefix-map` arguments

All of the -f*-prefix-map arguments currently don’t preserve the ordering given on the command line - instead ordering descending (or ascending, seemingly inconsistent):

The swift equivalent instead preserves the ordering given on the command line. Are there any objections to changing the semantics to always preserve the ordering given on the command line? The main case this would impact is cases where the flags are prefixes of one another, e.g.:


In such a case, the Features remapping should be given first if they want it to be used for files under the Features dir.

Hmm. I think I’d expect it to apply a more-specific-first match criteria across distinct specified prefixes, rather than command-line order. (That effectively just means sorting by descending length first, before doing a string comparison.)

That’s definitely another option. Regardless of which one we choose though, I think it makes sense to wrap this in a helper class just like Swift so it’ll be consistent (since it currently isn’t).