aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/ModuleBuilder.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-04-19 17:58:30 +0000
committerVedant Kumar <vsk@apple.com>2017-04-19 17:58:30 +0000
commitf224d707df89b4b338ac35d9a8d4cded8ce94021 (patch)
treed8f583ccf10bce29005c6effd77eaf04d27be5f0 /clang/lib/CodeGen/ModuleBuilder.cpp
parent3901377c229725a0d04a9971a1a0e945afb8286e (diff)
downloadllvm-f224d707df89b4b338ac35d9a8d4cded8ce94021.zip
llvm-f224d707df89b4b338ac35d9a8d4cded8ce94021.tar.gz
llvm-f224d707df89b4b338ac35d9a8d4cded8ce94021.tar.bz2
[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 llvm-svn: 300723
Diffstat (limited to 'clang/lib/CodeGen/ModuleBuilder.cpp')
-rw-r--r--clang/lib/CodeGen/ModuleBuilder.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/ModuleBuilder.cpp b/clang/lib/CodeGen/ModuleBuilder.cpp
index 89090c8..fc64285 100644
--- a/clang/lib/CodeGen/ModuleBuilder.cpp
+++ b/clang/lib/CodeGen/ModuleBuilder.cpp
@@ -197,7 +197,7 @@ namespace {
// 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 (!MD->getParent()->getDescribedClassTemplate())
+ if (!MD->getParent()->isDependentContext())
Builder->AddDeferredUnusedCoverageMapping(MD);
}