A theory of the upper critical field in antiferromagnetic superconductors