Skip to content

Commit

Permalink
update clang version
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaraslaut committed Jul 17, 2024
1 parent 06ae2cb commit aa43380
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
15 changes: 11 additions & 4 deletions .github/DockerClang
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
# docker buildx build --tag clang-p2996 --progress=plain -f .github/DockerClang --load .
# docker tag clang-p2996 yaraslaut/clang-p2996
# docker push yaraslaut/clang-p2996
FROM ubuntu:latest

# git clone -b p2996 https://github.com/Yaraslaut/clang-p2996.git && \
#git clone -b p2996 https://github.com/bloomberg/clang-p2996.git && \
WORKDIR /
RUN apt-get update
RUN apt-get install -y cmake python3 ninja-build git lsb-release software-properties-common wget binutils gcc g++
#RUN bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
RUN bash -c "\
set -ex && \
git clone -b p2996 https://github.com/bloomberg/clang-p2996.git && \
apt-get install -y cmake python3 ninja-build git lsb-release software-properties-common wget binutils gcc g++ && \
wget https://apt.llvm.org/llvm.sh && \
chmod +x llvm.sh && \
./llvm.sh 18 && \
git clone -b p2996 https://github.com/Yaraslaut/clang-p2996.git && \
cmake -S /clang-p2996/llvm \
-B build \
-G Ninja \
#-D CMAKE_CXX_COMPILER=clang++-18 \
#-D CMAKE_C_COMPILER=clang-18 \
-D CMAKE_CXX_COMPILER=clang++-18 \
-D CMAKE_C_COMPILER=clang-18 \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=\/usr \
-D LLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind'\
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# docker build . -t reflection --progress=plain
# clang++ -std=c++26 -freflection -stdlib=libc++

FROM yaraslaut/clang-p2996:latest
#FROM yaraslaut/clang-p2996:latest
FROM clang-p2996

COPY . /mnt/src
WORKDIR /mnt/src
Expand Down
8 changes: 4 additions & 4 deletions include/form/form.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ template <typename T> constexpr void print_members() {

template <typename S> consteval std::size_t get_padding() {

std::size_t pointer{offset_of(nonstatic_data_members_of(^S)[0]).bytes};
std::size_t padding{0};
std::size_t pointer{offset_of(nonstatic_data_members_of(^S)[0])};

[:util::expand(nonstatic_data_members_of(^S)):] >> [&, i = 0]<auto e>() {
if (pointer == offset_of(e))
if (pointer == offset_of(e).bytes)
pointer += size_of(e);
else {
padding += offset_of(e) - pointer;
pointer = offset_of(e) + size_of(e);
padding += offset_of(e).bytes - pointer;
pointer = offset_of(e).bytes + size_of(e);
}
};
return padding;
Expand Down
8 changes: 7 additions & 1 deletion include/form/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@

namespace form::util {

consteval auto name_of(auto type) { return name_of<std::string_view>(type); }
consteval auto name_of(auto refl) {
if (has_identifier(refl)) {
return identifier_of(refl);
} else {
return display_string_of(refl);
}
}

template <typename... Ts, typename F> constexpr void enumerate_types(F &&f) {
[&f]<auto... Is>(std::index_sequence<Is...>) {
Expand Down
6 changes: 6 additions & 0 deletions src/form.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef FORM_H_
#define FORM_H_



#endif // FORM_H_
7 changes: 5 additions & 2 deletions src/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,11 @@ void testZ() {
void testPrintMembers() { form::print_members<Z>(); }

void testCreateClass() {
constexpr auto cls = detail::CreateClass<detail::CreateUniqueT<int>>();
form::print_members<[:cls:]>();
using hidden_type = [:detail::CreateClass<detail::CreateUniqueT<int>>():];

constexpr hidden_type value{};
constexpr auto refl_of_value = ^value;
// form::print_members<[:type_of(refl_of_value):]>(); //TODO: Fix this
}

void testAA() {
Expand Down

0 comments on commit aa43380

Please # to comment.