[llvm-commits] [llvm] r72242 - in /llvm/trunk: include/llvm/ADT/Triple.h lib/Support/Triple.cpp
Daniel Dunbar
daniel at zuster.org
Thu May 21 19:24:11 PDT 2009
Author: ddunbar
Date: Thu May 21 21:24:11 2009
New Revision: 72242
URL: http://llvm.org/viewvc/llvm-project?rev=72242&view=rev
Log:
Add llvm::triple constructor from arch, vendor, os strings, and recognize
DragonFly OS type.
Modified:
llvm/trunk/include/llvm/ADT/Triple.h
llvm/trunk/lib/Support/Triple.cpp
Modified: llvm/trunk/include/llvm/ADT/Triple.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=72242&r1=72241&r2=72242&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Triple.h (original)
+++ llvm/trunk/include/llvm/ADT/Triple.h Thu May 21 21:24:11 2009
@@ -50,6 +50,7 @@
UnknownOS,
Darwin,
+ DragonFly,
FreeBSD,
Linux
};
@@ -75,6 +76,13 @@
Triple() : Data(""), Arch(InvalidArch) {}
explicit Triple(const char *Str) : Data(Str), Arch(InvalidArch) {}
+ explicit Triple(const char *ArchStr, const char *VendorStr, const char *OSStr)
+ : Data(ArchStr), Arch(InvalidArch) {
+ Data += '-';
+ Data += VendorStr;
+ Data += '-';
+ Data += OSStr;
+ }
/// @}
/// @name Typed Component Access
Modified: llvm/trunk/lib/Support/Triple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=72242&r1=72241&r2=72242&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Triple.cpp (original)
+++ llvm/trunk/lib/Support/Triple.cpp Thu May 21 21:24:11 2009
@@ -44,6 +44,7 @@
case UnknownOS: return "unknown";
case Darwin: return "darwin";
+ case DragonFly: return "dragonfly";
case FreeBSD: return "freebsd";
case Linux: return "linux";
}
@@ -80,6 +81,8 @@
std::string OSName = getOSName();
if (memcmp(&OSName[0], "darwin", 6) == 0)
OS = Darwin;
+ else if (memcmp(&OSName[0], "dragonfly", 9) == 0)
+ OS = DragonFly;
else if (memcmp(&OSName[0], "freebsd", 7) == 0)
OS = FreeBSD;
else if (memcmp(&OSName[0], "linux", 5) == 0)
More information about the llvm-commits
mailing list