InstrProf: Don't emit coverage for uninstantiated templates
We include unused functions and methods in -fcoverage-mapping so that we can differentiate between uninstrumented and unused. This can cause problems for uninstantiated templates though, since they may involve an incomplete type that can't be mangled. This shows up in things like libc++'s <unordered_map> and makes coverage unusable. Avoid the issue by skipping uninstantiated methods of a templated class. llvm-svn: 222204
This commit is contained in:
@@ -145,9 +145,11 @@ namespace {
|
||||
// } A;
|
||||
DeferredInlineMethodDefinitions.push_back(D);
|
||||
|
||||
// Always provide some coverage mapping
|
||||
// even for the methods that aren't emitted.
|
||||
Builder->AddDeferredUnusedCoverageMapping(D);
|
||||
// Provide some coverage mapping even for methods that aren't emitted.
|
||||
// Don't do this for templated classes though, as they may not be
|
||||
// instantiable.
|
||||
if (!D->getParent()->getDescribedClassTemplate())
|
||||
Builder->AddDeferredUnusedCoverageMapping(D);
|
||||
}
|
||||
|
||||
/// HandleTagDeclDefinition - This callback is invoked each time a TagDecl
|
||||
|
||||
Reference in New Issue
Block a user