Skip to content

Commit

Permalink
Merge pull request #194 from AntelopeIO/mikelik/clang-fix
Browse files Browse the repository at this point in the history
compile with clang-16
  • Loading branch information
mikelik authored Jun 22, 2023
2 parents 78ced4c + 7b058b4 commit 2838fe7
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .cicd/platforms.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
},
"ubuntu22": {
"dockerfile": ".cicd/platforms/ubuntu22.Dockerfile"
},
"ubuntu22-llvm": {
"dockerfile": ".cicd/platforms/ubuntu22-llvm.Dockerfile"
}
}
23 changes: 23 additions & 0 deletions .cicd/platforms/ubuntu22-llvm.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ubuntu:jammy

RUN apt-get update && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential \
cmake \
wget \
git \
ninja-build \
python3 \
pkg-config \
libboost-all-dev \
libcurl4-gnutls-dev \
lsb-release \
software-properties-common \
gnupg \
clang-tidy

RUN wget https://apt.llvm.org/llvm.sh
RUN chmod +x llvm.sh
RUN ./llvm.sh 16

ENV CC=clang-16
ENV CXX=clang++-16
2 changes: 1 addition & 1 deletion .cicd/platforms/ubuntu22.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ RUN apt-get update && apt-get upgrade -y && \
pkg-config \
libboost-all-dev \
libcurl4-gnutls-dev \
clang-tidy
clang-tidy
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [ubuntu18, ubuntu20, ubuntu22]
platform: [ubuntu18, ubuntu20, ubuntu22, ubuntu22-llvm]
runs-on: ["self-hosted", "enf-x86-beefy"]
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
steps:
Expand Down
15 changes: 2 additions & 13 deletions libraries/meta_refl/include/bluegrass/meta/function_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ namespace bluegrass { namespace meta {
template <typename T>
constexpr bool pass_type() { return true; }

template <typename>
constexpr bool is_callable_impl(...) {
return false;
}

template <typename T>
struct wrapper_t {
using type = T;
Expand All @@ -81,12 +76,6 @@ namespace bluegrass { namespace meta {
inline constexpr U&& make_dependent(U&& u) { return static_cast<U&&>(u); }
}

template <auto FN>
inline constexpr static bool is_callable_v = BLUEGRASS_HAS_MEMBER(AUTO_PARAM_WORKAROUND(FN), operator());

template <typename F>
constexpr bool is_callable(F&& fn) { return BLUEGRASS_HAS_MEMBER(fn, operator()); }

namespace detail {
template <bool Decay, typename R, typename... Args>
constexpr auto get_types(R(Args...)) -> std::tuple<R, freestanding,
Expand All @@ -111,7 +100,7 @@ namespace bluegrass { namespace meta {
std::tuple<std::conditional_t<Decay, std::decay_t<Args>, Args>...>>;
template <bool Decay, typename F>
constexpr auto get_types(F&& fn) {
if constexpr (is_callable_v<decltype(fn)>)
if constexpr (std::is_invocable<F>::value)
return get_types<Decay>(&F::operator());
else
return get_types<Decay>(fn);
Expand Down Expand Up @@ -153,7 +142,7 @@ namespace bluegrass { namespace meta {
constexpr auto parameters_from_impl(R(Cls::*)(Args...)const &&) -> pack_from_t<N, Args...>;
template <std::size_t N, typename F>
constexpr auto parameters_from_impl(F&& fn) {
if constexpr (is_callable_v<decltype(fn)>)
if constexpr (std::is_invocable<F>::value)
return parameters_from_impl<N>(&F::operator());
else
return parameters_from_impl<N>(fn);
Expand Down

0 comments on commit 2838fe7

Please sign in to comment.