There's been some back and forth if the cfg paths in the
config_map should be normcase()d. The argument for is that
it allows using all-lower spelling in cmd on Windows, the
argument against that doing so is lossy. (See r313918.)
Before the relative-paths-in-generated-lit.site.cfg.py work,
there was no downside to calling normcase(), but with it
we need a hack to recover the original case.
This time, normcase() the hashtable key, but store the original
cased key in addition to the value. This fixes both cons, at the
cost of a few bytes more memory.
Although it turned out to be unrelated to this patch, I leave this comment here:
check-clang started to fail with these kind of error messages:
The C\\ resulted from some printing problem, but what cause the issue was -include C:\users\.... with lower-case 'U' while the folder is upper case in the file system. It is the expansion of %s by lit.
Why would lit pass the wrong case? I suspected this patch.
The lower-case "user" originates from __file__ in Clang's lit.cfg.py assigned to config.test_source_root, which is used by Test.getSourcePath() to use as the substitution of %s. No idea why __file__ would not use the proper file's case, bit this call of os.path.realpath might have been intended to return the correct case.
Except, it doesn't. At least in the Python 3.7 that ships with the current Visual Studio. However, Python 3.8 changes the case from user to User. So my solution is to use Python 3.8 from now on, but I have no idea why it worked before or why nobody else seem to have the same problem. I leave this here in case might be useful to someone else.