diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-12 06:19:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-12 06:19:40 +0000 |
commit | 970e1b7ac8c812e2a74d42eaa1d582988f546d78 (patch) | |
tree | 0f921e90a2ae9cb7c0b24857723645f46964f3b3 /include/llvm/ADT | |
parent | afc55cc6037fa782bc5974bea0a79d4e3444bed9 (diff) | |
download | external_llvm-970e1b7ac8c812e2a74d42eaa1d582988f546d78.zip external_llvm-970e1b7ac8c812e2a74d42eaa1d582988f546d78.tar.gz external_llvm-970e1b7ac8c812e2a74d42eaa1d582988f546d78.tar.bz2 |
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
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r-- | include/llvm/ADT/Triple.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h index 31cf8ef..47f8b6e 100644 --- a/include/llvm/ADT/Triple.h +++ b/include/llvm/ADT/Triple.h @@ -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 /// @{ |