The coverage implementation marks functions which won't be emitted as
'deferred', so that it can emit empty coverage regions for them later
(once their linkages are known).
Functions in dependent contexts are an exception: if there isn't a full
instantiation of a function, it shouldn't be marked 'deferred'. We've
been breaking that rule without much consequence because we just ended
up with useless, extra, empty coverage mappings. With PR32679, this
behavior finally caused a crash, because clang marked a partial template
specialization as 'deferred', causing the MS mangler to choke in its
delayed-template-parsing mode:
error: cannot mangle this template type parameter type yet (http://bugs.llvm.org/show_bug.cgi?id=32679)
Fix this by checking if a decl's context is a dependent context before
marking it 'deferred'.
Based on a patch by Adam Folwarczny!