[clang][deps] NFC: Extract function

This commits extracts a couple of nested conditions into a separate function with early returns, making the control flow easier to understand.

GitOrigin-RevId: 97e504cff956b7120da9bd932644b00a853ee68a
2 files changed