Handle -fdelayed-template-parsing of out-of-line definitions of
class template member classes (PR19613)

Also improve this code in general by implementing suggestions
from Richard.

Differential Revision: http://reviews.llvm.org/D3555?id=9020

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207822 91177308-0d34-0410-b5e6-96231b3b80d8