- Need trimming before parsing major or minor version numbers. This's required due to the different line ending on Windows.
- In addition, the integer conversion may fail due to invalid char. Return that parsing function return true when the parsing fails.
A comment describing expected input format would be helpful here.
A comment that it returns true on failure to parse would be helpful.
Part.trim().split() (or, maybe, rtrim()if you only care about EOL) would save you trimming in each individual case.
It still does not desribe what we expect to see in that file.
HIP_VERSION_MAJOR=1 HIP_VERSION_MINOR=2 HIP_VERSION_PATCH=3
Perhaps we could use StringSwitch here:
int &Value = llvm::StringSwitch<int&>(Splits.first) .Case("HIP_VERSION_MAJOR", Major) .Case("HIP_VERSION_MINOR", Minor) .Case("HIP_VERSION_PATCH", VersionPatch) if (Splits.second.getAsInteger(0, Value)) return true;