|
56 | 56 |
|
57 | 57 | #define CODEQL_DIAGNOSTIC_LOG_FORMAT_PREFIX "[{}] " |
58 | 58 | // 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__); \ |
67 | 67 | } while (false) |
68 | 68 |
|
69 | 69 | // avoid calling into binlog's original macros |
@@ -232,34 +232,4 @@ class Logger { |
232 | 232 | Log::Level level_; |
233 | 233 | }; |
234 | 234 |
|
235 | | -namespace detail { |
236 | | -struct SwiftDiagnosticLogWrapper { |
237 | | - const SwiftDiagnostic& value; |
238 | | -}; |
239 | | - |
240 | | -} // namespace detail |
241 | 235 | } // 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