By convention, most structs and classes in the Swift compiler include a `dump()` method which prints debugging information. This method is meant to be called only from the debugger, but this means they’re often unused and may be eliminated from optimized binaries. On the other hand, some parts of the compiler call `dump()` methods directly despite them being intended as a pure debugging aid. clang supports attributes which can be used to avoid these problems, but they’re used very inconsistently across the compiler.
This commit adds `SWIFT_DEBUG_DUMP` and `SWIFT_DEBUG_DUMPER(<name>(<params>))` macros to declare `dump()` methods with the appropriate set of attributes and adopts this macro throughout the frontend. It does not pervasively adopt this macro in SILGen, SILOptimizer, or IRGen; these components use `dump()` methods in a different way where they’re frequently called from debugging code. Nor does it adopt it in runtime components like swiftRuntime and swiftReflection, because I’m a bit worried about size.
Despite the large number of files and lines affected, this change is NFC.
Summary:
The friend declaration wasn't qualified (it should have included the
namespace, i.e. `syntax::LegacyASTTransformer`). The effect was instead
to declare a `LegacyASTTransformer` inside the `swift` namespace, which
would then trip up Windows compilation because of non-conforming
two-phase lookup. The implication is that the friend declaration is
actually unneeded, since the incorrect declaration wasn't causing any
other problems, so we can just drop it.