swift
051e6e07 - [AutoDiff] declaration-only `SILDifferentiabilityWitness` (#27854)

Commit
6 years ago
[AutoDiff] declaration-only `SILDifferentiabilityWitness` (#27854) We need declaration-only `SILDifferentiabilityWitness` so that we can refer to differentiability witnesses defined in other modules. Therefore, this PR: * Adds distinct declaration/definition `create` methods for `SILDifferentiabilityWitness`. (credit to @dan-zheng's original work on this) * Handles the distinction in SIL printing & parsing: The definitions have a body in braces, and the declarations don't. * Handles the distinction in serialization: There is a new bit describing whether it's a declaration or definition. * Fixes the "deserialization currently fails if public function bodies are removed so that they are only declarations" problem noted in `test/AutoDiff/sil_differentiability_witness.sil`. * The overall purpose of this PR is to allow us to have decl-only differentiability witnesses referencing decl-only functions, so this fix is important to the overall purpose of this PR. * The change at `fn = State.getGlobalNameForReference(name, fnType, fnNameLoc);` in `ParseSIL.cpp` is what fixes this. * Adds test for a decl differentiability witness.
Author
marcrasi
Parents
Loading