add a couple of helpers to the Triple class for decoding

the darwin version string.  This should help consolidate
the variety of weird functions we have scattered around the
codebase that do stuff like this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78792 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2009-08-12 06:19:40 +00:00
parent e14463832c
commit dfc17f75e8
2 changed files with 80 additions and 0 deletions

View File

@@ -158,6 +158,21 @@ public:
/// if the environment component is present).
StringRef getOSAndEnvironmentName() const;
/// getDarwinNumber - Parse the 'darwin number' out of the specific target
/// triple. For example, if we have darwin8.5 return 8,5,0. If any entry is
/// not defined, return 0's. This requires that the triple have an OSType of
/// darwin before it is called.
void getDarwinNumber(unsigned &Maj, unsigned &Min, unsigned &Revision) const;
/// getDarwinMajorNumber - Return just the major version number, this is
/// specialized because it is a common query.
unsigned getDarwinMajorNumber() const {
unsigned Maj, Min, Rev;
getDarwinNumber(Maj, Min, Rev);
return Maj;
}
/// @}
/// @name Mutators
/// @{