In case anyone isn't sure why the original interaction is harassment: relationships within a reporting chain are generally prohibited, for both legal, ethical, and practical reasons. Sex becoming part of the effective job description crosses both legal and ethical lines, and team effectiveness is hindered when people wonder whether someone is getting special treatment because they're sleeping with the boss. A manager…
Tech workers (across all disciplines) need to unionize to combat this kind of thing. As has been pointed out below, HR that is staffed and incentivized by the company management only serves the interests of the management. A union is the only structure that can actually win demands for workers by organizing workers to withhold their labor. It's not a panacea, and there are several historical examples of union leaders…
I'm simplifying it a bit but if you don't like your job, just grab a copy of Cracking the Coding Interview and apply to big companies. The big companies pay very well, have good benefits and interview everyone because of the need for a high head count