This is an archive of the discontinued LLVM Phabricator instance.

[Coverage] Don't emit mappings for functions in dependent contexts (fixes PR32679)
ClosedPublic

Authored by vsk on Apr 17 2017, 5:30 PM.

Details

Summary

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!

Diff Detail

Repository
rL LLVM

Event Timeline

vsk created this revision.Apr 17 2017, 5:30 PM
adamf added a subscriber: adamf.Apr 18 2017, 1:08 AM

!MD->getParent()->getDescribedClassTemplate() looks like redundant now. This check is already done in isDependentContext.

arphaman accepted this revision.Apr 18 2017, 1:46 AM

I agree with Adam, the old check is now redundant.

LGTM after removing it.

test/CoverageMapping/pr32679.cpp
2 ↗(On Diff #95513)

Interesting, I didn't know about -implicit-check-not. Looks useful though.

This revision is now accepted and ready to land.Apr 18 2017, 1:46 AM
This revision was automatically updated to reflect the committed changes.