Skip to content

Commit

Permalink
Add support for Ananas platform
Browse files Browse the repository at this point in the history
Ananas is a home-brew operating system, mainly for amd64 machines. After
using GCC for quite some time, it has switched to clang and never looked
back - yet, having to manually patch things is annoying, so it'd be much
nicer if this was in the official tree.

More information:

https://github.com/zhmu/ananas/
https://rink.nu/projects/ananas.html

Submitted by:	Rink Springer
Differential Revision:	https://reviews.llvm.org/D32937


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306237 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
EdSchouten committed Jun 25, 2017
1 parent 750feae commit fc7d8c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/llvm/ADT/Triple.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class Triple {
enum OSType {
UnknownOS,

Ananas,
CloudABI,
Darwin,
DragonFly,
Expand Down
2 changes: 2 additions & 0 deletions lib/Support/Triple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ StringRef Triple::getOSTypeName(OSType Kind) {
switch (Kind) {
case UnknownOS: return "unknown";

case Ananas: return "ananas";
case CloudABI: return "cloudabi";
case Darwin: return "darwin";
case DragonFly: return "dragonfly";
Expand Down Expand Up @@ -455,6 +456,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {

static Triple::OSType parseOS(StringRef OSName) {
return StringSwitch<Triple::OSType>(OSName)
.StartsWith("ananas", Triple::Ananas)
.StartsWith("cloudabi", Triple::CloudABI)
.StartsWith("darwin", Triple::Darwin)
.StartsWith("dragonfly", Triple::DragonFly)
Expand Down
6 changes: 6 additions & 0 deletions unittests/ADT/TripleTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::UnknownOS, T.getOS());

T = Triple("x86_64-unknown-ananas");
EXPECT_EQ(Triple::x86_64, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::Ananas, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());

T = Triple("x86_64-unknown-cloudabi");
EXPECT_EQ(Triple::x86_64, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
Expand Down

0 comments on commit fc7d8c4

Please sign in to comment.