From bda516e9ea72fa09bec9bbe331dc87babe9139d5 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Mon, 21 Aug 2023 10:01:23 +0200 Subject: [PATCH] C++: tweak dispatcher clauses --- swift/extractor/infra/SwiftDispatcher.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/swift/extractor/infra/SwiftDispatcher.h b/swift/extractor/infra/SwiftDispatcher.h index 9da0ae100dc..c76ba31fad5 100644 --- a/swift/extractor/infra/SwiftDispatcher.h +++ b/swift/extractor/infra/SwiftDispatcher.h @@ -129,14 +129,14 @@ class SwiftDispatcher { // This method gives a TRAP label for already emitted AST node. // If the AST node was not emitted yet, then the emission is dispatched to a corresponding // visitor (see `visit(T *)` methods below). + // clang-format off template - requires std::constructible_from TrapLabelOf fetchLabel(const E& e, - swift::Type type = {}) { - if constexpr (std::constructible_from) { - if (!e) { - // this will be treated on emission - return undefined_label; - } + requires std::constructible_from + TrapLabelOf fetchLabel(const E* e, swift::Type type = {}) { + // clang-format on + if (!e) { + // this will be treated on emission + return undefined_label; } auto& stored = store[e]; if (!stored.valid()) { @@ -162,8 +162,11 @@ class SwiftDispatcher { return ret; } + // clang-format off template - requires std::constructible_from TrapLabelOf fetchLabel(const E& e) { + requires std::constructible_from + TrapLabelOf fetchLabel(const E& e) { + // clang-format on return fetchLabel(&e); }