How to block vision behind obstacles in RTS game?

Game such as Starcraft has a mechanism that anything behind obstacles (trees, cliff etc) is covered in Fog of War even if a unit’s sight circle touches it. I have been thinking how to do this efficiently for quite a while. A naive approach would be for each tile inside the unit’s sight circle, check if there is an obstacle between the unit and the tile. But I could imagine this won’t scale well when you have a lot of units on the map. Can anyone suggest a more efficient way of doing this?