]> granicus.if.org Git - clang/commit
[Coverage] Don't emit mappings for functions in dependent contexts (fixes PR32679)
authorVedant Kumar <vsk@apple.com>
Wed, 19 Apr 2017 17:58:30 +0000 (17:58 +0000)
committerVedant Kumar <vsk@apple.com>
Wed, 19 Apr 2017 17:58:30 +0000 (17:58 +0000)
commitbb9efcc8f831a2f913c5df1052943a43d87e40db
tree6dfef988ac1d472cef76ab027e74a31d8ca7e674
parent17081268e25326cb2afd21f56e5d12ac445a832c
[Coverage] Don't emit mappings for functions in dependent contexts (fixes PR32679)

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!

Differential Revision: https://reviews.llvm.org/D32144

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300723 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/ModuleBuilder.cpp
test/CoverageMapping/pr32679.cpp [new file with mode: 0644]