Merge remote-tracking branch 'origin/swift-3.1-branch' into stable
* origin/swift-3.1-branch:
Revert "Revert "[index] Handle properly C++14's template variables.""
[modules] Do not report missing definitions of demoted constexpr variable templates.
Reinstate r284008 reverted in r284081, with two fixes:
[modules] Allow VarDecls with initializers to use special var abbrev.
Revert accidentally checked in change in r281315.
Simplify. NFC.
Add a couple of test files missed in r281258.
[modules] When we merge two definitions of a function, mark the retained definition as visible in the discarded definition's module, as we do for other kinds of definition.
PR12298 et al: don't recursively instantiate a template specialization from within the instantiation of that same specialization. This could previously happen for eagerly-instantiated function templates, variable templates, exception specifications, default arguments, and a handful of other cases.
Fix regression introduced by r279164: only pass definitions as the PatternDef to DiagnoseUninstantiableTemplate, teach hasVisibleDefinition to correctly determine whether a function definition is visible, and mark both the function and the template as visible when merging function template definitions to provide hasVisibleDefinition with the relevant information.