Skip to content

Commit 970b3d0

Browse files
committed
Swift: upgrade clang-formatting to 15.0.7
1 parent 7c764f3 commit 970b3d0

File tree

4 files changed

+19
-22
lines changed

4 files changed

+19
-22
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
exclude: /test/.*$(?<!\.ql)(?<!\.qll)(?<!\.qlref)|.*\.patch
1111

1212
- repo: https://github.com/pre-commit/mirrors-clang-format
13-
rev: v13.0.1
13+
rev: v15.0.7
1414
hooks:
1515
- id: clang-format
1616
files: ^swift/.*\.(h|c|cpp)$

swift/extractor/infra/SwiftDispatcher.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ class SwiftDispatcher {
130130
// If the AST node was not emitted yet, then the emission is dispatched to a corresponding
131131
// visitor (see `visit(T *)` methods below).
132132
template <typename E>
133-
requires std::constructible_from<Handle, E> TrapLabelOf<E> fetchLabel(const E& e,
134-
swift::Type type = {}) {
133+
requires std::constructible_from<Handle, E>
134+
TrapLabelOf<E> fetchLabel(const E& e, swift::Type type = {}) {
135135
if constexpr (std::constructible_from<bool, const E&>) {
136136
if (!e) {
137137
// this will be treated on emission
@@ -163,7 +163,8 @@ class SwiftDispatcher {
163163
}
164164

165165
template <typename E>
166-
requires std::constructible_from<Handle, E*> TrapLabelOf<E> fetchLabel(const E& e) {
166+
requires std::constructible_from<Handle, E*>
167+
TrapLabelOf<E> fetchLabel(const E& e) {
167168
return fetchLabel(&e);
168169
}
169170

@@ -327,7 +328,10 @@ class SwiftDispatcher {
327328
virtual void visit(const swift::CapturedValue* capture) = 0;
328329

329330
template <typename T>
330-
requires(!std::derived_from<T, swift::TypeRepr>) void visit(const T* e, swift::Type) { visit(e); }
331+
requires(!std::derived_from<T, swift::TypeRepr>)
332+
void visit(const T* e, swift::Type) {
333+
visit(e);
334+
}
331335

332336
const swift::SourceManager& sourceManager;
333337
SwiftExtractorState& state;

swift/extractor/infra/SwiftLocationExtractor.h

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,19 @@ class TrapDomain;
1818
namespace detail {
1919
template <typename T>
2020
concept HasStartAndEndLoc = requires(T e) {
21-
e.getStartLoc();
22-
e.getEndLoc();
23-
};
21+
e.getStartLoc();
22+
e.getEndLoc();
23+
};
2424

2525
template <typename T>
26-
concept HasOneLoc = requires(T e) {
27-
e.getLoc();
28-
}
29-
&&(!HasStartAndEndLoc<T>);
26+
concept HasOneLoc = requires(T e) { e.getLoc(); } && (!HasStartAndEndLoc<T>);
3027

3128
template <typename T>
32-
concept HasOneLocField = requires(T e) {
33-
e.Loc;
34-
};
29+
concept HasOneLocField = requires(T e) { e.Loc; };
3530

3631
template <typename T>
37-
concept HasSourceRangeOnly = requires(T e) {
38-
e.getSourceRange();
39-
}
40-
&&(!HasStartAndEndLoc<T>)&&(!HasOneLoc<T>);
32+
concept HasSourceRangeOnly = requires(T e) { e.getSourceRange(); } && (!HasStartAndEndLoc<T>) &&
33+
(!HasOneLoc<T>);
4134

4235
swift::SourceRange getSourceRange(const HasStartAndEndLoc auto& locatable) {
4336
return {locatable.getStartLoc(), locatable.getEndLoc()};

swift/extractor/trap/TrapLabel.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ class TrapLabel : public UntypedTrapLabel {
8484
static TrapLabel unsafeCreateFromUntyped(UntypedTrapLabel label) { return TrapLabel{label.id_}; }
8585

8686
template <typename SourceTag>
87-
requires std::derived_from<SourceTag, Tag> TrapLabel(const TrapLabel<SourceTag>& other)
88-
: UntypedTrapLabel(other) {}
87+
requires std::derived_from<SourceTag, Tag>
88+
TrapLabel(const TrapLabel<SourceTag>& other) : UntypedTrapLabel(other) {}
8989
};
9090

9191
// wrapper class to allow directly assigning a vector of TrapLabel<A> to a vector of
@@ -97,7 +97,7 @@ struct TrapLabelVectorWrapper {
9797
std::vector<TrapLabel<TagParam>> data;
9898

9999
template <typename DestinationTag>
100-
requires std::derived_from<Tag, DestinationTag>
100+
requires std::derived_from<Tag, DestinationTag>
101101
operator std::vector<TrapLabel<DestinationTag>>() && {
102102
// reinterpret_cast is safe because TrapLabel instances differ only on the type, not the
103103
// underlying data

0 commit comments

Comments
 (0)