[llvm-commits] [llvm] r137111 - /llvm/trunk/lib/Support/Unix/Host.inc
Bob Wilson
bob.wilson at apple.com
Mon Aug 8 22:13:36 PDT 2011
Author: bwilson
Date: Tue Aug 9 00:13:36 2011
New Revision: 137111
URL: http://llvm.org/viewvc/llvm-project?rev=137111&view=rev
Log:
Recognize the UNAME_RELEASE environment variable to match Darwin's uname.
When this variable is set, "uname -r" will return its value instead of the
real OS version. Make this affect LLVM's triple for consistency.
<rdar://problem/9919167>
Modified:
llvm/trunk/lib/Support/Unix/Host.inc
Modified: llvm/trunk/lib/Support/Unix/Host.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Host.inc?rev=137111&r1=137110&r2=137111&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Host.inc (original)
+++ llvm/trunk/lib/Support/Unix/Host.inc Tue Aug 9 00:13:36 2011
@@ -22,12 +22,18 @@
#include <sys/utsname.h>
#include <cctype>
#include <string>
+#include <cstdlib> // ::getenv
using namespace llvm;
static std::string getOSVersion() {
struct utsname info;
+ // Recognize UNAME_RELEASE environment variable to match Darwin uname.
+ const char *UnameOverride = ::getenv("UNAME_RELEASE");
+ if (UnameOverride && UnameOverride[0] != '\0')
+ return UnameOverride;
+
if (uname(&info))
return "";
More information about the llvm-commits
mailing list