In this particular case it would be possible to just add an else with CGM.setDSOLocal(GV), but it seems better to have as many callers as possible just call setGVProperties so that we can centralize the logic there.
This patch then makes setGVProperties able to handle null Decls.
This looks like Ty->getAsCXXRecordDecl().