Revert "Swift: upgrade clang-formatting to 15.0.7"

This reverts commit 970b3d06be.
This commit is contained in:
Paolo Tranquilli
2023-08-18 13:59:07 +02:00
parent 3c4e755233
commit c17a582b34
4 changed files with 25 additions and 20 deletions

View File

@@ -10,7 +10,7 @@ repos:
exclude: /test/.*$(?<!\.ql)(?<!\.qll)(?<!\.qlref)|.*\.patch
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.7
rev: v13.0.1
hooks:
- id: clang-format
files: ^swift/.*\.(h|c|cpp)$

View File

@@ -130,8 +130,8 @@ class SwiftDispatcher {
// If the AST node was not emitted yet, then the emission is dispatched to a corresponding
// visitor (see `visit(T *)` methods below).
template <typename E>
requires std::constructible_from<Handle, E>
TrapLabelOf<E> fetchLabel(const E& e, swift::Type type = {}) {
requires std::constructible_from<Handle, E> TrapLabelOf<E> fetchLabel(const E& e,
swift::Type type = {}) {
if constexpr (std::constructible_from<bool, const E&>) {
if (!e) {
// this will be treated on emission
@@ -163,8 +163,7 @@ class SwiftDispatcher {
}
template <typename E>
requires std::constructible_from<Handle, E*>
TrapLabelOf<E> fetchLabel(const E& e) {
requires std::constructible_from<Handle, E*> TrapLabelOf<E> fetchLabel(const E& e) {
return fetchLabel(&e);
}
@@ -328,10 +327,7 @@ class SwiftDispatcher {
virtual void visit(const swift::CapturedValue* capture) = 0;
template <typename T>
requires(!std::derived_from<T, swift::TypeRepr>)
void visit(const T* e, swift::Type) {
visit(e);
}
requires(!std::derived_from<T, swift::TypeRepr>) void visit(const T* e, swift::Type) { visit(e); }
const swift::SourceManager& sourceManager;
SwiftExtractorState& state;

View File

@@ -18,19 +18,26 @@ class TrapDomain;
namespace detail {
template <typename T>
concept HasStartAndEndLoc = requires(T e) {
e.getStartLoc();
e.getEndLoc();
};
e.getStartLoc();
e.getEndLoc();
};
template <typename T>
concept HasOneLoc = requires(T e) { e.getLoc(); } && (!HasStartAndEndLoc<T>);
concept HasOneLoc = requires(T e) {
e.getLoc();
}
&&(!HasStartAndEndLoc<T>);
template <typename T>
concept HasOneLocField = requires(T e) { e.Loc; };
concept HasOneLocField = requires(T e) {
e.Loc;
};
template <typename T>
concept HasSourceRangeOnly = requires(T e) { e.getSourceRange(); } && (!HasStartAndEndLoc<T>) &&
(!HasOneLoc<T>);
concept HasSourceRangeOnly = requires(T e) {
e.getSourceRange();
}
&&(!HasStartAndEndLoc<T>)&&(!HasOneLoc<T>);
swift::SourceRange getSourceRange(const HasStartAndEndLoc auto& locatable) {
return {locatable.getStartLoc(), locatable.getEndLoc()};
@@ -62,7 +69,9 @@ swift::SourceRange getSourceRange(const llvm::MutableArrayRef<Locatable>& locata
} // namespace detail
template <typename E>
concept IsLocatable = requires(E e) { detail::getSourceRange(e); };
concept IsLocatable = requires(E e) {
detail::getSourceRange(e);
};
class SwiftLocationExtractor {
public:

View File

@@ -83,8 +83,8 @@ class TrapLabel : public UntypedTrapLabel {
static TrapLabel unsafeCreateFromUntyped(UntypedTrapLabel label) { return TrapLabel{label.id_}; }
template <typename SourceTag>
requires std::derived_from<SourceTag, Tag>
TrapLabel(const TrapLabel<SourceTag>& other) : UntypedTrapLabel(other) {}
requires std::derived_from<SourceTag, Tag> TrapLabel(const TrapLabel<SourceTag>& other)
: UntypedTrapLabel(other) {}
};
// wrapper class to allow directly assigning a vector of TrapLabel<A> to a vector of
@@ -96,7 +96,7 @@ struct TrapLabelVectorWrapper {
std::vector<TrapLabel<TagParam>> data;
template <typename DestinationTag>
requires std::derived_from<Tag, DestinationTag>
requires std::derived_from<Tag, DestinationTag>
operator std::vector<TrapLabel<DestinationTag>>() && {
// reinterpret_cast is safe because TrapLabel instances differ only on the type, not the
// underlying data