Commit Graph

8 Commits

Author SHA1 Message Date
Paolo Tranquilli
8291b2229a Swift: turn internal error into a TSP warning 2023-05-16 15:18:29 +02:00
Paolo Tranquilli
cfcd26cf0d Swift: support markdown TSP diagnostics 2023-05-15 13:48:24 +02:00
Paolo Tranquilli
cce9352272 Swift: add visibility customization to diagnostics 2023-05-12 09:05:45 +02:00
Paolo Tranquilli
03f4625b5f Swift: go back to explicit DIAGNOSE_ERROR macros 2023-05-12 06:30:58 +02:00
Paolo Tranquilli
3f2a059b3b Swift: add location support to TSP diagnostics
This required a bit of an overhaul of the original integration of
JSON diagnostics into binlog.

The problem is that it is quite hard to add a kind of metadata to
binlog entries without changing its code. Another problem is that when
wanting to avoid double evaluation of logging macro arguments one
cannot really add a separate "diagnose" step easily.

The proposed solution consists in two things:
* hook into a binlog plumbing function by providing a better overload
  resolution match, which happens after logging macro expansion,
  bypassing the problem of double evaluation
* in that hook, produce the diagnostic directly, without waiting to
  reconstruct the diagnostics entry from the binlog serialized entry.

This allows to forgo the weird category to diagnostic mapping, and now a
diagnostics emission simply happens when a diagnostic source is given
as the first argument after the log format string. A flavour of
diganostics sources with locations is then added with the same
mechanism, allowing to write something like
```cpp
LOG_ERROR("[{}] ouch!", internalError.withLocation("foo.swift", 32));
```
2023-05-11 17:52:02 +02:00
Paolo Tranquilli
7ce1189e36 Swift: tweak after review comments 2023-05-04 15:14:46 +02:00
Paolo Tranquilli
d61e366441 Swift: replace assert with CODEQL_ASSERT 2023-05-04 12:15:58 +02:00
Paolo Tranquilli
bce483ddb1 Swift: rename log package to logging 2023-05-04 10:42:39 +02:00