Skip to content

Commit 162439f

Browse files
committed
Use LLVM 21 for CI
1 parent 34c2412 commit 162439f

File tree

12 files changed

+70
-58
lines changed

12 files changed

+70
-58
lines changed

cpp/include/ggl/buffer.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ template <> constexpr Buffer as_buffer(std::span<std::uint8_t> bytes) noexcept {
9797
}
9898

9999
template <class Traits = std::char_traits<std::uint8_t>>
100-
constexpr Buffer as_buffer(std::basic_string_view<std::uint8_t, Traits> sv
100+
constexpr Buffer as_buffer(
101+
std::basic_string_view<std::uint8_t, Traits> sv
101102
) noexcept {
102103
return Buffer { const_cast<std::uint8_t *>(sv.data()), sv.size() };
103104
}

cpp/include/ggl/list.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ class List : public GglList {
6666

6767
reference at(size_type pos) const {
6868
if (pos >= size()) {
69-
GGL_THROW_OR_ABORT(std::out_of_range("ggl::List::at: out of range")
69+
GGL_THROW_OR_ABORT(
70+
std::out_of_range("ggl::List::at: out of range")
7071
);
7172
}
7273

cpp/include/ggl/map.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ class Map : public GglMap {
109109
Object &at(key_type key) const {
110110
auto found = find(key);
111111
if (found == cend()) {
112-
GGL_THROW_OR_ABORT(std::out_of_range {
113-
"ggl::Map::at: Non-existent key." });
112+
GGL_THROW_OR_ABORT(
113+
std::out_of_range { "ggl::Map::at: Non-existent key." }
114+
);
114115
}
115116
return *(found->second);
116117
}
@@ -179,7 +180,8 @@ class Map : public GglMap {
179180
return temp;
180181
}
181182

182-
constexpr difference_type operator-(const MapIterator &rhs
183+
constexpr difference_type operator-(
184+
const MapIterator &rhs
183185
) const noexcept {
184186
return std::distance(rhs.kv, kv);
185187
}

cpp/include/ggl/object.hpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ class [[nodiscard]] Object : public GglObject {
137137
// Assumes Object is a Map
138138
Object operator[](std::string_view key) const {
139139
if (index() != GGL_TYPE_MAP) {
140-
GGL_THROW_OR_ABORT(Exception { GGL_ERR_PARSE,
141-
"ggl::Object is not ggl::Map" });
140+
GGL_THROW_OR_ABORT(
141+
Exception { GGL_ERR_PARSE, "ggl::Object is not ggl::Map" }
142+
);
142143
}
143144

144145
return *Map { ggl_obj_into_map(*this) }[key];
@@ -147,8 +148,9 @@ class [[nodiscard]] Object : public GglObject {
147148
// Assumes Object is a List
148149
Object operator[](std::size_t idx) const {
149150
if (index() != GGL_TYPE_LIST) {
150-
GGL_THROW_OR_ABORT(Exception { GGL_ERR_PARSE,
151-
"ggl::Object is not ggl::List" });
151+
GGL_THROW_OR_ABORT(
152+
Exception { GGL_ERR_PARSE, "ggl::Object is not ggl::List" }
153+
);
152154
}
153155
return List { ggl_obj_into_list(*this) }[idx];
154156
}
@@ -187,8 +189,9 @@ template <ObjectType T> constexpr GglObjectType index_for_type() noexcept {
187189
template <ObjectType T> T get(Object obj) {
188190
using Type = std::remove_cvref_t<T>;
189191
if (obj.index() != index_for_type<Type>()) {
190-
GGL_THROW_OR_ABORT(Exception { GGL_ERR_PARSE,
191-
"get: Bad index for object." });
192+
GGL_THROW_OR_ABORT(
193+
Exception { GGL_ERR_PARSE, "get: Bad index for object." }
194+
);
192195
}
193196
if constexpr (std::is_same_v<Type, bool>) {
194197
return ggl_obj_into_bool(obj);

cpp/src/ipc/client.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ std::error_code Client::connect(
4040
);
4141
}
4242

43-
std::error_code Client::update_component_state(GglComponentState state
43+
std::error_code Client::update_component_state(
44+
GglComponentState state
4445
) noexcept {
4546
return ggipc_update_state(state);
4647
}
@@ -63,7 +64,8 @@ std::error_code Client::publish_to_iot_core(
6364
return ggipc_publish_to_iot_core(as_buffer(topic), bytes, qos);
6465
}
6566

66-
std::error_code Client::restart_component(std::string_view component_name
67+
std::error_code Client::restart_component(
68+
std::string_view component_name
6769
) noexcept {
6870
return ggipc_restart_component(as_buffer(component_name));
6971
}

flake.nix

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020
];
2121
};
2222

23-
llvmStdenv = pkgs: pkgs.overrideCC pkgs.llvmPackages.stdenv
24-
(pkgs.llvmPackages.stdenv.cc.override
25-
{ inherit (pkgs.llvmPackages) bintools; });
23+
llvmStdenv = pkgs: pkgs.overrideCC pkgs.llvmPackages_21.stdenv
24+
(pkgs.llvmPackages_21.stdenv.cc.override
25+
{ inherit (pkgs.llvmPackages_21) bintools; });
2626
in
2727
{
2828
inherit inputs;
2929
systems = [ "x86_64-linux" "aarch64-linux" ];
3030

3131
devShell = pkgs: {
3232
packages = with pkgs; [
33-
clang-tools
33+
llvmPackages_21.clang-tools
3434
clangd-tidy
3535
git
3636
cmake
@@ -47,9 +47,9 @@
4747
stdenv = lib.mkForce (llvmStdenv pkgs);
4848
};
4949

50-
formatters = { llvmPackages, cmake-format, nodePackages, yapf, ... }:
50+
formatters = { llvmPackages_21, cmake-format, nodePackages, yapf, ... }:
5151
let
52-
fmt-c = "${llvmPackages.clang-unwrapped}/bin/clang-format -i";
52+
fmt-c = "${llvmPackages_21.clang-unwrapped}/bin/clang-format -i";
5353
fmt-cmake = "${cmake-format}/bin/cmake-format -i";
5454
fmt-yaml =
5555
"${nodePackages.prettier}/bin/prettier --write --parser yaml";

include/ggl/buffer.h

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ typedef struct {
4343
#ifndef GGL_DISABLE_MACRO_TYPE_CHECKING
4444
/// Create buffer literal from a byte array.
4545
#define GGL_BUF(...) \
46-
_Generic((&(__VA_ARGS__)), uint8_t(*)[]: GGL_BUF_UNCHECKED(__VA_ARGS__))
46+
_Generic((&(__VA_ARGS__)), uint8_t (*)[]: GGL_BUF_UNCHECKED(__VA_ARGS__))
4747
#else
4848
#define GGL_BUF GGL_BUF_UNCHECKED
4949
#endif
@@ -101,28 +101,26 @@ bool ggl_buffer_contains(GglBuffer buf, GglBuffer substring, size_t *start);
101101
/// The result is the overlap between the start to end range and the input
102102
/// bounds.
103103
CONST
104-
GglBuffer ggl_buffer_substr(GglBuffer buf, size_t start, size_t end)
105-
CBMC_CONTRACT(
106-
requires(cbmc_buffer_restrict(&buf)),
107-
requires(start < end),
108-
ensures(cbmc_implies(
109-
(buf.data == NULL),
110-
(cbmc_return.data == NULL) && (cbmc_return.len == 0)
111-
)),
112-
ensures(cbmc_implies(
113-
(buf.data != NULL),
114-
(cbmc_ptr_in_range(buf.data, cbmc_return.data, buf.data + buf.len)),
115-
((cbmc_return.data - buf.data) <= (buf.len - cbmc_return.len))
116-
)),
117-
ensures(cbmc_implies(
118-
(buf.data != NULL) && (start <= buf.len),
119-
(cbmc_return.data == buf.data + start)
120-
)),
121-
ensures(cbmc_implies(
122-
(buf.data != NULL) && (end <= buf.len),
123-
(cbmc_return.len == end - start)
124-
)),
125-
);
104+
GglBuffer
105+
ggl_buffer_substr(GglBuffer buf, size_t start, size_t end) CBMC_CONTRACT(
106+
requires(cbmc_buffer_restrict(&buf)),
107+
requires(start < end),
108+
ensures(cbmc_implies(
109+
(buf.data == NULL), (cbmc_return.data == NULL) && (cbmc_return.len == 0)
110+
)),
111+
ensures(cbmc_implies(
112+
(buf.data != NULL),
113+
(cbmc_ptr_in_range(buf.data, cbmc_return.data, buf.data + buf.len)),
114+
((cbmc_return.data - buf.data) <= (buf.len - cbmc_return.len))
115+
)),
116+
ensures(cbmc_implies(
117+
(buf.data != NULL) && (start <= buf.len),
118+
(cbmc_return.data == buf.data + start)
119+
)),
120+
ensures(cbmc_implies(
121+
(buf.data != NULL) && (end <= buf.len), (cbmc_return.len == end - start)
122+
)),
123+
);
126124

127125
/// Parse an integer from a string
128126
ACCESS(write_only, 2)

include/ggl/macro_util.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@
3737
#define GGL_MACRO_FOREACH(macro, join, ...) \
3838
GGL_MACRO_RESCAN_16(GGL_MACRO_FOREACH__ITER(macro, join, __VA_ARGS__))
3939
#define GGL_MACRO_FOREACH__ITER(macro, join, arg, ...) \
40-
macro(arg \
41-
) __VA_OPT__(join GGL_MACRO_HIDE(FOREACH__ITER)(macro, join, __VA_ARGS__))
40+
macro(arg) __VA_OPT__( \
41+
join GGL_MACRO_HIDE(FOREACH__ITER)(macro, join, __VA_ARGS__) \
42+
)
4243

4344
#define GGL_MACRO_ID(...) __VA_ARGS__
4445

priv_include/ggl/vector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ typedef struct {
8080
#define GGL_BYTE_VEC(...) \
8181
_Generic( \
8282
(&(__VA_ARGS__)), \
83-
uint8_t(*)[]: GGL_BYTE_VEC_UNCHECKED(__VA_ARGS__), \
84-
char(*)[]: GGL_BYTE_VEC_UNCHECKED(__VA_ARGS__) \
83+
uint8_t (*)[]: GGL_BYTE_VEC_UNCHECKED(__VA_ARGS__), \
84+
char (*)[]: GGL_BYTE_VEC_UNCHECKED(__VA_ARGS__) \
8585
)
8686
#else
8787
#define GGL_BYTE_VEC GGL_BYTE_VEC_UNCHECKED

samples/restart_component/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ int main(void) {
2626
sleep(1);
2727
}
2828

29-
printf("Restarting component "
30-
"'aws-greengrass-sdk-lite.samples.restart_component'...\n");
29+
printf(
30+
"Restarting component "
31+
"'aws-greengrass-sdk-lite.samples.restart_component'...\n"
32+
);
3133
err = ggipc_restart_component(
3234
GGL_STR("aws-greengrass-sdk-lite.samples.restart_component")
3335
);

0 commit comments

Comments
 (0)