IRGen: Fix asserting local extern declarations.
Explanation:
LLVM currently asserts on local extern variables in C headers passed to
Swift when the definition exists outside that header.
Scope: This never worked.
Risk: Low.
Testing: Regression test added.
Reviewed-by: John McCall
Original PR: #33306
This fix also required the cherry-pick of: #31035 and #31272
rdar://67951491