Proper handling of static local variables with address space qualifiers.

Similar to the implementation for globals in r157167.

Patch by Jingyue Wu.