This is an archive of the discontinued LLVM Phabricator instance.

clang-cl: Fix path-based MSVC version detection
ClosedPublic

Authored by hans on May 16 2017, 2:12 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

hans created this revision.May 16 2017, 2:12 PM
hans added a subscriber: thakis.May 16 2017, 2:36 PM

Nico asked about tests. This whole thing landed (r297851) without tests, and I'm not sure it's worth the effort adding one for this :-/

rnk edited edge metadata.May 16 2017, 2:46 PM

I'd rather not hardcode all the msvc archs. IMO we should just look up one level and check if that's called bin, and continue if so. I think I had:

bool IsBin = llvm::sys::path::filename(PathEntry).compare_lower("bin");
if (!IsBin) {
  PathEntry = llvm::sys::path::parent_path(PathEntry);
  IsBin = llvm::sys::path::filename(TestPath).compare_lower("bin");
}
if (IsBin) {
  ...

The compare_lower is also a fix, because my path looks like ".../VC/Bin".

hans updated this revision to Diff 99213.May 16 2017, 3:05 PM

Addressing comments.

rnk accepted this revision.May 16 2017, 4:35 PM

lgtm

This revision is now accepted and ready to land.May 16 2017, 4:35 PM
This revision was automatically updated to reflect the committed changes.