Skip to content

Commit 95bc4dc

Browse files
committed
Clang 18
Switched to Clang 18 and updated GCC to 13. This release uses macOS 14 @arm. The docker containers used for building are multi platform supporting Intel and ARM.
1 parent b777e0e commit 95bc4dc

23 files changed

+121
-76
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ on:
1212
types: [rebuild_trigger]
1313

1414
env:
15-
CMAKE_VERSION: 3.16.2
16-
NINJA_VERSION: 1.10.0
17-
LLVM_VERSION: 17.0.0
15+
CMAKE_VERSION: 3.29.0
16+
NINJA_VERSION: 1.11.1
17+
LLVM_VERSION: 18.1.0
1818

1919
jobs:
2020
checks:
@@ -29,7 +29,7 @@ jobs:
2929
name: "Linux Clang - Format check",
3030
os: ubuntu-20.04,
3131
build_type: Release,
32-
cformat_name: 'clang-format-17'
32+
cformat_name: 'clang-format-18'
3333
}
3434

3535
steps:
@@ -42,7 +42,7 @@ jobs:
4242
run: |
4343
wget https://apt.llvm.org/llvm.sh
4444
chmod +x llvm.sh
45-
sudo ./llvm.sh 17
45+
sudo ./llvm.sh 18
4646
sudo apt-get install ${{ matrix.config.cformat_name }}
4747
4848
- name: clang-format check
@@ -64,11 +64,11 @@ jobs:
6464
config:
6565
# AppleClang
6666
- {
67-
name: "Clang 17 / LLVM 17 @ macOS Release",
68-
os: macos-11,
67+
name: "Clang 18 / LLVM 18 @ macOS Release",
68+
os: macos-14,
6969
build_type: Release,
7070
cxx: "clang++",
71-
llvm_version: "17.0.0",
71+
llvm_version: "18.1.0",
7272
llvm_config: "llvm-config",
7373
coverage: "No",
7474
static: "No",
@@ -78,15 +78,16 @@ jobs:
7878
bin_name: "insights",
7979
archive_name: "insights-macos",
8080
upload: "Yes",
81+
cmake_args: "-DCMAKE_OSX_ARCHITECTURES=arm64",
8182
}
8283

8384
# AppleClang
8485
- {
85-
name: "Clang 17 / LLVM 17 @ macOS Debug",
86-
os: macos-11,
86+
name: "Clang 18 / LLVM 18 @ macOS Debug",
87+
os: macos-14,
8788
build_type: Release,
8889
cxx: "clang++",
89-
llvm_version: "17.0.0",
90+
llvm_version: "18.1.0",
9091
llvm_config: "llvm-config",
9192
coverage: "No",
9293
static: "No",
@@ -96,15 +97,16 @@ jobs:
9697
bin_name: "insights",
9798
archive_name: "insights-macos",
9899
upload: "No",
100+
cmake_args: "-DCMAKE_OSX_ARCHITECTURES=arm64",
99101
}
100102

101103
# # AppleClang
102104
# - {
103-
# name: "Clang 17 / LLVM 17 @ macOS Coverage & Debug",
104-
# os: macos-11,
105+
# name: "Clang 18 / LLVM 18 @ macOS Coverage & Debug",
106+
# os: macos-14,
105107
# build_type: Release,
106108
# cxx: "clang++",
107-
# llvm_version: "17.0.0",
109+
# llvm_version: "18.1.0",
108110
# llvm_config: "llvm-config",
109111
# coverage: "Yes",
110112
# static: "No",
@@ -118,11 +120,11 @@ jobs:
118120

119121
# # MSVC 2019
120122
# - {
121-
# name: "MSVC 2022 / LLVM 17 @ Windows Release",
123+
# name: "MSVC 2022 / LLVM 18 @ Windows Release",
122124
# os: windows-2022,
123125
# build_type: Release,
124126
# cxx: "cl",
125-
# llvm_version: "17.0.0",
127+
# llvm_version: "18.1.0",
126128
# llvm_config: "current/bin/llvm-config.exe",
127129
# static: "Yes",
128130
# debug: "No",
@@ -137,11 +139,11 @@ jobs:
137139

138140
# # MSVC 2019
139141
# - {
140-
# name: "MSVC 2022 / LLVM 17 @ Windows Debug",
142+
# name: "MSVC 2022 / LLVM 18 @ Windows Debug",
141143
# os: windows-2022,
142144
# build_type: Release,
143145
# cxx: "cl",
144-
# llvm_version: "17.0.0",
146+
# llvm_version: "18.1.0",
145147
# llvm_config: "current/bin/llvm-config.exe",
146148
# static: "Yes",
147149
# debug: "Yes",
@@ -155,11 +157,11 @@ jobs:
155157

156158
# # MSVC 2019
157159
# - {
158-
# name: "MSVC 2022 / LLVM 17 @ Windows Code Coverage & Debug",
160+
# name: "MSVC 2022 / LLVM 18 @ Windows Code Coverage & Debug",
159161
# os: windows-2022,
160162
# build_type: Release,
161163
# cxx: "clang-cl.exe",
162-
# llvm_version: "17.0.0",
164+
# llvm_version: "18.1.0",
163165
# llvm_config: "current/bin/llvm-config.exe",
164166
# coverage: "Yes",
165167
# static: "Yes",
@@ -199,8 +201,8 @@ jobs:
199201
cmake_dir="${cmake_base_dir}/bin"
200202
elif [ "$RUNNER_OS" == "macOS" ]; then
201203
ninja_suffix="mac.zip"
202-
cmake_suffix="Darwin-x86_64.tar.gz"
203-
cmake_base_dir="cmake-${cmake_version}-Darwin-x86_64"
204+
cmake_suffix="macos-universal.tar.gz"
205+
cmake_base_dir="cmake-${cmake_version}-macos-universal"
204206
cmake_dir="${cmake_base_dir}/CMake.app/Contents/bin"
205207
fi
206208
@@ -261,12 +263,12 @@ jobs:
261263
key: ${{ runner.os }}-clang-${{ matrix.config.llvm_version }}-${{ hashFiles('${{ github.workspace }}/current') }}
262264

263265
- name: Install Clang
264-
if: "(startsWith(matrix.config.os, 'macos') || startsWith(matrix.config.os, 'Window')) && steps.cache-clang-binary.outputs.cache-hit != 'true'"
266+
if: "(startsWith(matrix.config.os, 'macos') || startsWith(matrix.config.os, 'Window'))"
265267
shell: cmake -P {0}
266268
run: |
267269
set(llvm_version ${{ matrix.config.llvm_version }})
268270
set(path_separator ":")
269-
set(archive_name "clang+llvm-${llvm_version}-x86_64-apple-darwin")
271+
set(archive_name "clang+llvm-${llvm_version}-arm64-apple-darwin")
270272
if ("${{ runner.os }}" STREQUAL "Windows")
271273
set(archive_name "clang+llvm-${llvm_version}-win64-msvc")
272274
set(path_separator ";")
@@ -322,7 +324,7 @@ jobs:
322324
export HOMEBREW_NO_AUTO_UPDATE=1
323325
brew update > /dev/null
324326
brew install lcov || brew upgrade lcov
325-
brew install gcc@10 || brew upgrade gcc@10 # for Clang 17 and newer gcov
327+
brew install gcc@10 || brew upgrade gcc@10 # for Clang 18 and newer gcov
326328
327329
- name: Setup MSVC Dev
328330
if: "startsWith(matrix.config.os, 'Windows')"
@@ -465,13 +467,13 @@ jobs:
465467
fail-fast: false
466468
matrix:
467469
config:
468-
# GCC 12 / LLVM 17
470+
# GCC 13 / LLVM 18
469471
- {
470-
name: "GCC 12 / LLVM 17 @ Ubuntu Release @docker",
472+
name: "GCC 13 / LLVM 18 @ Ubuntu Release @docker",
471473
build_type: Release,
472-
cxx: "g++-12",
473-
llvm_version: "17.0.0",
474-
llvm_config: "/usr/bin/llvm-config-17",
474+
cxx: "g++-13",
475+
llvm_version: "18.1.0",
476+
llvm_config: "/usr/bin/llvm-config-18",
475477
coverage: "No",
476478
static: "Yes",
477479
debug: "No",
@@ -484,13 +486,13 @@ jobs:
484486
docs: "Yes",
485487
}
486488

487-
# GCC 12 / LLVM 17
489+
# GCC 13 / LLVM 18
488490
- {
489-
name: "GCC 12 / LLVM 17 @ Ubuntu Code Coverage & Debug @docker",
491+
name: "GCC 13 / LLVM 18 @ Ubuntu Code Coverage & Debug @docker",
490492
build_type: Release,
491-
cxx: "g++-12",
492-
llvm_version: "17.0.0",
493-
llvm_config: "/usr/bin/llvm-config-17",
493+
cxx: "g++-13",
494+
llvm_version: "18.1.0",
495+
llvm_config: "/usr/bin/llvm-config-18",
494496
coverage: "Yes",
495497
static: "No",
496498
debug: "Yes",
@@ -501,13 +503,13 @@ jobs:
501503
archive_name: "insights-ubuntu-14.04",
502504
}
503505

504-
# GCC 12 / LLVM 17
506+
# GCC 13 / LLVM 18
505507
- {
506-
name: "GCC 12 / LLVM 17 @ Ubuntu Code Coverage (libc++) @docker",
508+
name: "GCC 13 / LLVM 18 @ Ubuntu Code Coverage (libc++) @docker",
507509
build_type: Release,
508-
cxx: "g++-12",
509-
llvm_version: "17.0.0",
510-
llvm_config: "/usr/bin/llvm-config-17",
510+
cxx: "g++-13",
511+
llvm_version: "18.1.0",
512+
llvm_config: "/usr/bin/llvm-config-18",
511513
coverage: "Yes",
512514
static: "No",
513515
debug: "Yes",

CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
2-
# 3.8* is required because of C++17 support
1+
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
32

43
# For better control enable MSVC_RUNTIME_LIBRARY target property
54
# see https://cmake.org/cmake/help/latest/policy/CMP0091.html
@@ -33,7 +32,7 @@ option(INSIGHTS_STATIC "Use static linking" Off)
3332

3433
set(INSIGHTS_LLVM_CONFIG "llvm-config" CACHE STRING "LLVM config executable to use")
3534

36-
set(INSIGHTS_MIN_LLVM_MAJOR_VERSION 17)
35+
set(INSIGHTS_MIN_LLVM_MAJOR_VERSION 18)
3736
set(INSIGHTS_MIN_LLVM_VERSION ${INSIGHTS_MIN_LLVM_MAJOR_VERSION}.0)
3837

3938
if(NOT DEFINED LLVM_VERSION_MAJOR) # used when build inside the clang tool/extra folder
@@ -372,6 +371,17 @@ if (BUILD_INSIGHTS_OUTSIDE_LLVM)
372371
# additional libs required when building insights outside llvm
373372
set(ADDITIONAL_LIBS
374373
${LLVM_LDFLAGS}
374+
)
375+
376+
if(${LLVM_PACKAGE_VERSION_PLAIN} VERSION_GREATER_EQUAL "18.0.0")
377+
set(ADDITIONAL_LIBS
378+
${ADDITIONAL_LIBS}
379+
clangAPINotes
380+
)
381+
endif()
382+
383+
set(ADDITIONAL_LIBS
384+
${ADDITIONAL_LIBS}
375385
clangFrontend
376386
clangDriver
377387
clangSerialization
@@ -768,6 +778,7 @@ message(STATUS "[ Build summary ]")
768778
message(STATUS "CMAKE_GENERATOR : ${CMAKE_GENERATOR}")
769779
message(STATUS "CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
770780
message(STATUS "CMAKE_LINKER : ${CMAKE_LINKER}")
781+
message(STATUS "CMAKE_OSX_ARCHITECTURES : ${CMAKE_OSX_ARCHITECTURES}")
771782
message(STATUS "Compiler ID : ${CMAKE_CXX_COMPILER_ID}")
772783
message(STATUS "Compiler version : ${CMAKE_CXX_COMPILER_VERSION}")
773784
message(STATUS "Compiler path : ${CMAKE_CXX_COMPILER}")

Readme.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ There are a couple of options that can be enabled with [cmake](https://cmake.org
174174
| INSIGHTS_USE_LIBCPP | Use libc++ for tests | OFF |
175175
| DEBUG | Enable debug | OFF |
176176
177+
### Building for ARM on macOS
178+
179+
It seems best to supply the architecture during configuration:
180+
181+
```
182+
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 ../cppinsights
183+
```
184+
177185
178186
### Use it with [Cevelop](https://www.cevelop.com)
179187

scripts/prepare-release.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
def main():
1515
versionH = open('version.h.in', 'r').read()
1616

17-
oldClangStable = '16'
18-
newClangStable = '17'
19-
newInsightsVersion = '17.0'
17+
oldClangStable = '17'
18+
newClangStable = '18'
19+
newInsightsVersion = '18.0'
2020
oldInsightsVersion = re.search(r'INSIGHTS_VERSION\s+"(.*?)"', versionH, re.DOTALL | re.MULTILINE).group(1)
2121

2222

tests/ClassOpInTemplateFunctionTest.expect

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class Foo
4343
{
4444
if constexpr(true) {
4545
return this->mX;
46+
} else /* constexpr */ {
4647
}
4748

4849
}

tests/EduCoroutineCoAwaitOperatorTest.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ awaiter operator co_await<long long, std::ratio<1, 1000> >(std::chrono::duration
148148

149149
};
150150

151-
return awaiter{std::chrono::duration<long long, std::ratio<1, 1000000> >(d, nullptr)};
151+
return awaiter{std::chrono::duration<long long, std::ratio<1, 1000000> >(d)};
152152
}
153153
#endif
154154

tests/IfSwitchInitHandler5Test.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
int main()
55
{
66
std::shared_ptr<int> sharedPtr = std::make_shared<int>(2011);
7-
std::weak_ptr<int> weakPtr = std::weak_ptr<int>(sharedPtr, 0);
7+
std::weak_ptr<int> weakPtr = std::weak_ptr<int>(sharedPtr);
88
{
99
std::shared_ptr<int> sharedPtr1 = weakPtr.lock();
1010
if(sharedPtr1.operator bool()) {

tests/Issue15.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
std::chrono::duration<long long, std::ratio<1, 1> > operator""_s(unsigned long long s)
77
{
8-
return std::chrono::duration<long long, std::ratio<1, 1> >(s, nullptr);
8+
return std::chrono::duration<long long, std::ratio<1, 1> >(s);
99
}
1010

1111
std::basic_string<char, std::char_traits<char>, std::allocator<char> > operator""_str(const char * s, std::size_t len)

tests/Issue41.cerr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
29 | template<class type_parameter_0_0>
66
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
77
In file included from .tmp.cpp:1:
8-
In file included from ... vector:310:
8+
In file included from ... vector:314:
99
In file included from ... remove.h:13:
1010
... find_if.h:25:9: error: no matching function for call to object of type '__lambda_12_26'
1111
25 | if (__pred(*__first))

tests/LambdaHandlerVLA2Test.cerr

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
.tmp.cpp:3:15: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
2+
3 | char buffer[n];
3+
| ^
4+
.tmp.cpp:3:15: note: function parameter 'n' with unknown value cannot be used in a constant expression
5+
.tmp.cpp:1:15: note: declared here
6+
1 | void Test(int n)
7+
| ^
18
.tmp.cpp:14:5: warning: declaration does not declare anything [-Wmissing-declarations]
29
14 | unsigned long;
310
| ^~~~~~~~~~~~~
@@ -7,6 +14,13 @@
714
.tmp.cpp:1:15: note: 'n' declared here
815
1 | void Test(int n)
916
| ^
17+
.tmp.cpp:15:20: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
18+
15 | char (&buffer)[n];
19+
| ^
20+
.tmp.cpp:15:20: note: function parameter 'n' with unknown value cannot be used in a constant expression
21+
.tmp.cpp:1:15: note: declared here
22+
1 | void Test(int n)
23+
| ^
1024
.tmp.cpp:15:12: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
1125
15 | char (&buffer)[n];
1226
| ^
@@ -16,6 +30,13 @@
1630
.tmp.cpp:1:15: note: 'n' declared here
1731
1 | void Test(int n)
1832
| ^
33+
.tmp.cpp:18:34: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
34+
18 | __lambda_6_5(char (&_buffer)[n])
35+
| ^
36+
.tmp.cpp:18:34: note: function parameter 'n' with unknown value cannot be used in a constant expression
37+
.tmp.cpp:1:15: note: declared here
38+
1 | void Test(int n)
39+
| ^
1940
.tmp.cpp:22:5: error: no matching constructor for initialization of 'class __lambda_6_5'
2041
22 | } __lambda_6_5{buffer};
2142
| ^ ~~~~~~~~
@@ -28,4 +49,4 @@
2849
.tmp.cpp:18:5: note: candidate constructor not viable: no known conversion from 'char[n]' to 'char (&)[n]' for 1st argument
2950
18 | __lambda_6_5(char (&_buffer)[n])
3051
| ^ ~~~~~~~~~~~~~~~~~~
31-
1 warning and 4 errors generated.
52+
4 warnings and 4 errors generated.

tests/MacroExpensionTest.expect

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ enum eTest
1414
/* PASSED: static_assert(true); */
1515

1616
template<class T>
17-
constexpr const T pi = T(3.14159265358979323851L);
17+
constexpr const T pi = T(3.1415926535897931L);
1818

1919
template<>
20-
constexpr const int pi<int> = int(3.14159265358979323851L);
20+
constexpr const int pi<int> = int(3.1415926535897931L);
2121

2222
int i = pi<int>;

0 commit comments

Comments
 (0)