David Miranda, a child of the Rio de Janeiro slums who became a leading voice for gay rights in Brazil’s Congress and who played a supporting role in the leak of classified documents by Edward J. Snowden, died on Tuesday in Rio de Janeiro. He was 37.