Skip to content

Commit

Permalink
Make Xcode 15 the minimum required version
Browse files Browse the repository at this point in the history
  • Loading branch information
MikePopoloski committed Sep 23, 2023
1 parent f264e17 commit 2825b67
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 32 deletions.
2 changes: 1 addition & 1 deletion docs/building.dox
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ slang requires the following tools in order to build:
- C++20 compatible compiler. Minimum supported compiler versions:
- GCC 10
- clang 16
- XCode 14.3
- Xcode 15
- MSVC support is tested only against the most recent update of VS 2022

@section building-start Quick Start
Expand Down
22 changes: 4 additions & 18 deletions source/ast/builtins/ConversionFuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,6 @@
#include "slang/ast/SystemSubroutine.h"
#include "slang/ast/types/Type.h"

// TODO: remove once AppleClang finally adds support for this
template<typename Dest, typename Source>
inline Dest bit_cast(const Source& src) noexcept {
static_assert(sizeof(Dest) == sizeof(Source),
"bit_cast requires source and destination to be the same size");
static_assert(std::is_trivially_copyable<Dest>::value,
"bit_cast requires the destination type to be copyable");
static_assert(std::is_trivially_copyable<Source>::value,
"bit_cast requires the source type to be copyable");
Dest dst;
std::memcpy(&dst, &src, sizeof(Dest));
return dst;
}

namespace slang::ast::builtins {

class SignedConversionFunction : public SystemSubroutine {
Expand Down Expand Up @@ -115,7 +101,7 @@ class RealToBitsFunction : public SimpleSystemSubroutine {
if (!val)
return nullptr;

return SVInt(64, bit_cast<uint64_t>(val.real()), false);
return SVInt(64, std::bit_cast<uint64_t>(val.real()), false);
}
};

Expand All @@ -133,7 +119,7 @@ class BitsToRealFunction : public SimpleSystemSubroutine {
return nullptr;

uint64_t i = val.integer().as<uint64_t>().value_or(0);
return real_t(bit_cast<double>(i));
return real_t(std::bit_cast<double>(i));
}
};

Expand All @@ -150,7 +136,7 @@ class ShortRealToBitsFunction : public SimpleSystemSubroutine {
if (!val)
return nullptr;

return SVInt(32, bit_cast<uint32_t>(val.shortReal()), false);
return SVInt(32, std::bit_cast<uint32_t>(val.shortReal()), false);
}
};

Expand All @@ -168,7 +154,7 @@ class BitsToShortRealFunction : public SimpleSystemSubroutine {
return nullptr;

uint32_t i = val.integer().as<uint32_t>().value_or(0);
return shortreal_t(bit_cast<float>(i));
return shortreal_t(std::bit_cast<float>(i));
}
};

Expand Down
16 changes: 3 additions & 13 deletions source/numeric/ConstantValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ bool operator==(const ConstantValue& lhs, const ConstantValue& rhs) {

std::partial_ordering operator<=>(const ConstantValue& lhs, const ConstantValue& rhs) {
return std::visit(
[&](auto&& arg) {
[&](auto&& arg) -> std::partial_ordering {
constexpr auto unordered = std::partial_ordering::unordered;
using T = std::decay_t<decltype(arg)>;
if constexpr (std::is_same_v<T, std::monostate>)
Expand Down Expand Up @@ -596,14 +596,10 @@ std::partial_ordering operator<=>(const ConstantValue& lhs, const ConstantValue&
return arg <=> std::get<ConstantValue::Elements>(rhs.value);
}
else if constexpr (std::is_same_v<T, std::string>) {
// TODO: clean this up once Xcode / libc++ get their act together
if (!rhs.isString())
return unordered;

int cmp = arg.compare(rhs.str());
return cmp < 0 ? std::partial_ordering::less
: cmp == 0 ? std::partial_ordering::equivalent
: std::partial_ordering::greater;
return arg <=> rhs.str();
}
else if constexpr (std::is_same_v<T, ConstantValue::Map>) {
if (!rhs.isMap())
Expand All @@ -621,13 +617,7 @@ std::partial_ordering operator<=>(const ConstantValue& lhs, const ConstantValue&
if (!rhs.isUnion())
return unordered;

// TODO: clean this up once Xcode / libc++ get their act together
auto& ru = rhs.unionVal();
if (arg->activeMember < ru->activeMember)
return std::partial_ordering::less;
if (arg->activeMember > ru->activeMember)
return std::partial_ordering::greater;
return arg->value <=> ru->value;
return *arg <=> *rhs.unionVal();
}
else {
static_assert(always_false<T>::value, "Missing case");
Expand Down

0 comments on commit 2825b67

Please sign in to comment.