doing和having done都是现在分词,后者是现在分词的完成式,用作状语,表达“谓语动词之前”的动作。
例:I got to the office earlier that day, ____ (catch) the 7:30 train from Paddington. (2013年高考全国卷II)
答案是having caught。
从句意看,catch the train在got to the office之前,即:(因为)赶上了7:30的车,(所以)早到了办公室,故用having caught。
这个句子也可以写作:Having caught the 7:30 train from Paddington, I got to the office earlier that day.
可见,无论分词结构在句首还是句末,都要用完成式表达“在谓语动词之前”的含义。