diff options
author | Justin Bogner <mail@justinbogner.com> | 2014-11-18 00:34:46 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2014-11-18 00:34:46 +0000 |
commit | 94d384e4231e5e1e511873e421fdb63b175d64f0 (patch) | |
tree | 33398976dd304efd972416bb6cf241676c1e78ca /clang/lib/CodeGen/ModuleBuilder.cpp | |
parent | a64bd44fd8269bdd246fb21a7ca645e957bc9501 (diff) | |
download | bcm5719-llvm-94d384e4231e5e1e511873e421fdb63b175d64f0.tar.gz bcm5719-llvm-94d384e4231e5e1e511873e421fdb63b175d64f0.zip |
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
Diffstat (limited to 'clang/lib/CodeGen/ModuleBuilder.cpp')
-rw-r--r-- | clang/lib/CodeGen/ModuleBuilder.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/ModuleBuilder.cpp b/clang/lib/CodeGen/ModuleBuilder.cpp index 6c60b4e62c1..ee6f6f94c71 100644 --- a/clang/lib/CodeGen/ModuleBuilder.cpp +++ b/clang/lib/CodeGen/ModuleBuilder.cpp @@ -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 |