Skip to content

Commit c17a582

Browse files
committed
Revert "Swift: upgrade clang-formatting to 15.0.7"
This reverts commit 970b3d0.
1 parent 3c4e755 commit c17a582

File tree

4 files changed

+25
-20
lines changed

4 files changed

+25
-20
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: v15.0.7
13+
rev: v13.0.1
1414
hooks:
1515
- id: clang-format
1616
files: ^swift/.*\.(h|c|cpp)$

swift/extractor/infra/SwiftDispatcher.h

Lines changed: 4 additions & 8 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>
134-
TrapLabelOf<E> fetchLabel(const E& e, swift::Type type = {}) {
133+
requires std::constructible_from<Handle, E> TrapLabelOf<E> fetchLabel(const E& e,
134+
swift::Type type = {}) {
135135
if constexpr (std::constructible_from<bool, const E&>) {
136136
if (!e) {
137137
// this will be treated on emission
@@ -163,8 +163,7 @@ class SwiftDispatcher {
163163
}
164164

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

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

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

336332
const swift::SourceManager& sourceManager;
337333
SwiftExtractorState& state;

swift/extractor/infra/SwiftLocationExtractor.h

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,26 @@ 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) { e.getLoc(); } && (!HasStartAndEndLoc<T>);
26+
concept HasOneLoc = requires(T e) {
27+
e.getLoc();
28+
}
29+
&&(!HasStartAndEndLoc<T>);
2730

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

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

3542
swift::SourceRange getSourceRange(const HasStartAndEndLoc auto& locatable) {
3643
return {locatable.getStartLoc(), locatable.getEndLoc()};
@@ -62,7 +69,9 @@ swift::SourceRange getSourceRange(const llvm::MutableArrayRef<Locatable>& locata
6269
} // namespace detail
6370

6471
template <typename E>
65-
concept IsLocatable = requires(E e) { detail::getSourceRange(e); };
72+
concept IsLocatable = requires(E e) {
73+
detail::getSourceRange(e);
74+
};
6675

6776
class SwiftLocationExtractor {
6877
public:

swift/extractor/trap/TrapLabel.h

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

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

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

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

0 commit comments

Comments
 (0)