Skip to content

Commit dbff3e4

Browse files
committed
Swift: remove unneeded SwiftDiagnosticLogWrapper
1 parent a2cb331 commit dbff3e4

File tree

1 file changed

+8
-38
lines changed

1 file changed

+8
-38
lines changed

swift/logging/SwiftLogging.h

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@
5656

5757
#define CODEQL_DIAGNOSTIC_LOG_FORMAT_PREFIX "[{}] "
5858
// TODO(C++20) replace non-standard , ##__VA_ARGS__ with __VA_OPT__(,) __VA_ARGS__
59-
#define DIAGNOSE_WITH_LEVEL(LEVEL, ID, FORMAT, ...) \
60-
do { \
61-
auto _now = ::binlog::clockNow(); \
62-
const ::codeql::SwiftDiagnostic& _id = ID; \
63-
::codeql::Log::diagnose(_id, std::chrono::nanoseconds{_now}, \
64-
fmt::format(FORMAT, ##__VA_ARGS__)); \
65-
LOG_WITH_LEVEL_AND_TIME(LEVEL, _now, CODEQL_DIAGNOSTIC_LOG_FORMAT_PREFIX FORMAT, \
66-
::codeql::detail::SwiftDiagnosticLogWrapper{_id}, ##__VA_ARGS__); \
59+
#define DIAGNOSE_WITH_LEVEL(LEVEL, ID, FORMAT, ...) \
60+
do { \
61+
auto _now = ::binlog::clockNow(); \
62+
const ::codeql::SwiftDiagnostic& _id = ID; \
63+
::codeql::Log::diagnose(_id, std::chrono::nanoseconds{_now}, \
64+
fmt::format(FORMAT, ##__VA_ARGS__)); \
65+
LOG_WITH_LEVEL_AND_TIME(LEVEL, _now, CODEQL_DIAGNOSTIC_LOG_FORMAT_PREFIX FORMAT, \
66+
_id.abbreviation(), ##__VA_ARGS__); \
6767
} while (false)
6868

6969
// avoid calling into binlog's original macros
@@ -232,34 +232,4 @@ class Logger {
232232
Log::Level level_;
233233
};
234234

235-
namespace detail {
236-
struct SwiftDiagnosticLogWrapper {
237-
const SwiftDiagnostic& value;
238-
};
239-
240-
} // namespace detail
241235
} // namespace codeql
242-
243-
namespace mserialize {
244-
// log diagnostics wrapper using the abbreviation of the underlying diagnostic, using
245-
// binlog/mserialize internal plumbing
246-
template <>
247-
struct CustomTag<codeql::detail::SwiftDiagnosticLogWrapper, void>
248-
: detail::BuiltinTag<std::string> {
249-
using T = codeql::detail::SwiftDiagnosticLogWrapper;
250-
};
251-
252-
template <>
253-
struct CustomSerializer<codeql::detail::SwiftDiagnosticLogWrapper, void> {
254-
template <typename OutputStream>
255-
static void serialize(const codeql::detail::SwiftDiagnosticLogWrapper& source,
256-
OutputStream& out) {
257-
mserialize::serialize(source.value.abbreviation(), out);
258-
}
259-
260-
static size_t serialized_size(const codeql::detail::SwiftDiagnosticLogWrapper& source) {
261-
return mserialize::serialized_size(source.value.abbreviation());
262-
}
263-
};
264-
265-
} // namespace mserialize

0 commit comments

Comments
 (0)