summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CoverageMappingGen.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2015-05-01 19:23:34 +0000
committerJustin Bogner <mail@justinbogner.com>2015-05-01 19:23:34 +0000
commit96ae73f7240dcf05ecc1a769163a8e876cf7388d (patch)
tree477ef6b0dee3a0481ca95faed8ae813368240c3e /clang/lib/CodeGen/CoverageMappingGen.cpp
parent9de946fa1fb355ded560fd4435c954bdb45bc804 (diff)
downloadbcm5719-llvm-96ae73f7240dcf05ecc1a769163a8e876cf7388d.tar.gz
bcm5719-llvm-96ae73f7240dcf05ecc1a769163a8e876cf7388d.zip
InstrProf: Fix a coverage crash where a macro begins in an unreachable block
llvm-svn: 236335
Diffstat (limited to 'clang/lib/CodeGen/CoverageMappingGen.cpp')
-rw-r--r--clang/lib/CodeGen/CoverageMappingGen.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index 38848b032c9..fca17264e8f 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -447,7 +447,10 @@ struct CounterCoverageMappingBuilder
/// This should be used after visiting any statements in non-source order.
void adjustForOutOfOrderTraversal(SourceLocation EndLoc) {
MostRecentLocation = EndLoc;
- if (MostRecentLocation == getEndOfFileOrMacro(MostRecentLocation))
+ // Avoid adding duplicate regions if we have a completed region on the top
+ // of the stack and are adjusting to the end of a virtual file.
+ if (getRegion().hasEndLoc() &&
+ MostRecentLocation == getEndOfFileOrMacro(MostRecentLocation))
MostRecentLocation = getIncludeOrExpansionLoc(MostRecentLocation);
}
OpenPOWER on IntegriCloud