llvm.org GIT mirror llvm / 4860fe0
ADT/Triple: Add helper function for OS X version checks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129801 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 9 years ago
1 changed file(s) with 24 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
248248 return getOSMajorVersion();
249249 }
250250
251 bool isOSVersionLT(unsigned Major, unsigned B_Minor, unsigned Micro) {
251 bool isOSVersionLT(unsigned Major, unsigned Minor = 0,
252 unsigned Micro = 0) const {
252253 unsigned LHS[3];
253254 getOSVersion(LHS[0], LHS[1], LHS[2]);
254255
262263 return false;
263264 }
264265
266 /// isOSX - Is this an OS X triple. For legacy reasons, we support both
267 /// "darwin" and "osx" as OS X triples.
268 bool isOSX() const {
269 return getOS() == Triple::Darwin || getOS() == Triple::OSX;
270 }
271
272 /// isOSXVersionLT - Comparison function for checking OS X version
273 /// compatibility, which handles supporting skewed version numbering schemes
274 /// used by the "darwin" triples.
275 unsigned isOSXVersionLT(unsigned Major, unsigned Minor = 0,
276 unsigned Micro = 0) const {
277 assert(isOSX() && "Not an OS X triple!");
278
279 // If this is OS X, expect a sane version number.
280 if (getOS() == Triple::OSX)
281 return isOSVersionLT(Major, Minor, Micro);
282
283 // Otherwise, compare to the "Darwin" number.
284 assert(Major == 10 && "Unexpected major version");
285 return isOSVersionLT(Minor + 4, Micro, 0);
286 }
287
265288 /// @}
266289 /// @name Mutators
267290 /// @{