Compute the visibility of static local variables consistently.  Fixes PR16208.