Add a GlobalAlias::isValidLinkage to reduce code duplication.

Thanks to Reid Kleckner for the suggestion.