De-duplicate TypeCheckingFlags, TypeChecker's Options, and the TypeChecker-Oriented FrontendOptions into a dedicated TypeCheckerOptions type. This moves a bunch of configuration state out of the type checker and into the ASTContext where it belongs.
Educational notes are small pieces of documentation which explain a concept
relevant to some diagnostic message. If -enable-descriptive-diagnostics is
passed, they will be printed after a diagnostic message if available.
Educational notes can be found at /usr/share/doc/diagnostics in a
toolchain, and are associated with specific compiler diagnostics in
EducationalNotes.def.
Diagnose ephemeral conversions that are passed to @_nonEphemeral
parameters. Currently, this defaults to a warning with a frontend flag
to upgrade to an error. Hopefully this will become an error by default
in a future language version.
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.
This addresses comments from Joe to document the special behaviour that
we do in the `addSubsitution` functions which cause a subtle failure on
Windows.
The order of evaluation of the subscript operator would increase the
count of map, resulting in the decoration to be off by one. This
enables building the swift standard library on Windows again.
This flag will feature-gate work on producing more descriptive diagnostic messages.
It will remain a hidden frontend option until these improvements are ready to ship.
SourceManager may outlive ASTContext where external source file paths are managed.
Therefore, we should use the identifier from the memory buffer as the key instead of
using a pointer from an ASTContext.
When Decl::getLoc() is called upon a serialized AST and the
serialized source location is available, we lazily open the
external buffer and return a valid SourceLoc instance pointing
into the buffer.
This is the only omission kind that needs to look in the middle of a
name rather than just at the start or the end. So, handle that
explicitly instead to simplify all the other code.
This flag will enable all experimental differentiable programming features.
The default will be `true` on tensorflow branch but `false` on master branch.
Features will first be updated on tensorflow branch to use this flag, before
being upstreamed to master. The goal is to achieve a minimal code diff between
the two branches.
The [TF-820](https://bugs.swift.org/browse/TF-820) master issue tracks upstreaming differentiable programming.
---
Rationale: we chose to add a frontend flag rather than a `build-script`/CMake flag for easier testing. Differentiable programming `lit` tests can be run by specifying this additional flag without recompiling the compiler and standard library.
[Forum discussion on upstreaming differentiable programming.](https://forums.swift.org/t/upstreaming-differentiable-attribute-and-differentiable-protocol/26821)
- No need to hash input values first
- Pass many values to a single hash_combine to save on intermediates
- Use hash_combine_range instead of a loop of hash_combines
No functionality change.
We have a lot of "transform a range" types already:
llvm::mapped_iterator, swift::TransformRange and
swift::TransformIterator, and swift::ArrayRefView for static
transformations. This gets rid of one more layer without losing
any real functionality.
Pointer data in some remote reflection targets may required relocation, or may not be
fully resolvable, such as when we're dumping info from a single image on disk that
references other dynamic libraries. Add a `RemoteAbsolutePointer` type that can hold a
symbol, offset, or combination of both, and add APIs to `MemoryReader` and `MetadataReader`
for reading pointers that can get unresolved relocation info from an image, or apply
relocations to pointer information. MetadataReader can use the symbol name information to
fill in demanglings of symbolic-reference-bearing mangled names by using the information
from the symbol name to fill in the name even though the context descriptors are not
available.
For now, this is NFC (MemoryReader::resolvePointer just forwards the pointer data), but
lays the groundwork for implementation of relocation in ObjectMemoryReader.