When attempting to split a coroutine with 'hidden' visibility (for
example, a C++ coroutine that is inlined when compiled with the option
'-fvisibility-inlines-hidden'), LLVM would hit an assertion in
include/llvm/IR/GlobalValue.h:240: "local linkage requires default
visibility". The issue is that the visibility is copied from the source
of the function split in the CloneFunctionInto function, but the linkage
is not. To fix, create the new function first with external linkage,
then copy the linkage from the original function *after* CloneFunctionInto
is called.
Since GlobalValue::setLinkage in turn calls maybeSetDsoLocal, the
explicit call to setDSOLocal can be removed in CoroSplit.cpp.
Test Plan: check-llvm