summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/HostInfo.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-03-26 15:58:36 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-03-26 15:58:36 +0000
commitc7fd57a2f3c86b7ac40e60138f38c51cece90a62 (patch)
tree9d4cacf18ce633db199a4054501f898a4cce20e0 /clang/lib/Driver/HostInfo.cpp
parent4e5696b984c3b07e1b9c46c563554beb341d93a0 (diff)
downloadbcm5719-llvm-c7fd57a2f3c86b7ac40e60138f38c51cece90a62.tar.gz
bcm5719-llvm-c7fd57a2f3c86b7ac40e60138f38c51cece90a62.zip
Driver: Move GetReleaseVersion to static Driver::GetReleaseVersion method.
llvm-svn: 67754
Diffstat (limited to 'clang/lib/Driver/HostInfo.cpp')
-rw-r--r--clang/lib/Driver/HostInfo.cpp36
1 files changed, 3 insertions, 33 deletions
diff --git a/clang/lib/Driver/HostInfo.cpp b/clang/lib/Driver/HostInfo.cpp
index 8f762095b61..c02267fbdc8 100644
--- a/clang/lib/Driver/HostInfo.cpp
+++ b/clang/lib/Driver/HostInfo.cpp
@@ -72,37 +72,6 @@ public:
const char *ArchName) const;
};
-/// GetReleaseVersion - Parse (([0-9]+)(.([0-9]+)(.([0-9]+)?))?)? and
-/// return the grouped values as integers. Numbers which are not
-/// provided are set to 0.
-///
-/// \return True if the entire string was parsed (9.2), or all groups
-/// were parsed (10.3.5extrastuff).
-static bool GetReleaseVersion(const char *Str, unsigned &Major,
- unsigned &Minor, unsigned &Micro) {
- Major = Minor = Micro = 0;
- if (*Str == '\0')
- return true;
-
- char *End;
- Major = (unsigned) strtol(Str, &End, 10);
- if (*Str != '\0' && *End == '\0')
- return true;
- if (*End != '.')
- return false;
-
- Str = End+1;
- Minor = (unsigned) strtol(Str, &End, 10);
- if (*Str != '\0' && *End == '\0')
- return true;
- if (*End != '.')
- return false;
-
- Str = End+1;
- Micro = (unsigned) strtol(Str, &End, 10);
- return true;
-}
-
DarwinHostInfo::DarwinHostInfo(const Driver &D, const char *_Arch,
const char *_Platform, const char *_OS)
: HostInfo(D, _Arch, _Platform, _OS) {
@@ -114,8 +83,9 @@ DarwinHostInfo::DarwinHostInfo(const Driver &D, const char *_Arch,
assert(memcmp(&getOSName()[0], "darwin", 6) == 0 &&
"Unknown Darwin platform.");
const char *Release = &getOSName()[6];
- if (!GetReleaseVersion(Release, DarwinVersion[0], DarwinVersion[1],
- DarwinVersion[2])) {
+ bool HadExtra;
+ if (!Driver::GetReleaseVersion(Release, DarwinVersion[0], DarwinVersion[1],
+ DarwinVersion[2], HadExtra)) {
D.Diag(clang::diag::err_drv_invalid_darwin_version)
<< Release;
}
OpenPOWER on IntegriCloud