]> granicus.if.org Git - clang/commit
InstrProf: Rewrite most of coverage mapping generation in a simpler way
authorJustin Bogner <mail@justinbogner.com>
Wed, 18 Feb 2015 21:24:51 +0000 (21:24 +0000)
committerJustin Bogner <mail@justinbogner.com>
Wed, 18 Feb 2015 21:24:51 +0000 (21:24 +0000)
commitad5a787c1d24443f5358966afb5025469d8ea4a3
treea2d5a4494af779f20a0b96548e43bbea3565b547
parent1bc0d0a5c9e9742ee09645361a8525e5947062bc
InstrProf: Rewrite most of coverage mapping generation in a simpler way

The coverage mapping generation code previously generated a large
number of redundant coverage regions and then tried to merge similar
ones back together. This then relied on some awkward heuristics to
prevent combining of regions that were importantly different but
happened to have the same count. The end result was inefficient and
hard to follow.

Now, we more carefully create the regions we actually want. This makes
it much easier to create regions at precise locations as well as
making the basic approach quite a bit easier to follow. There's still
a fair bit of complexity here dealing with included code and macro
expansions, but that's pretty hard to avoid without significantly
reducing the quality of data we provide.

I had to modify quite a few tests where the source ranges became more
precise or the old ranges seemed to be wrong anyways, and I've added
quite a few new tests since a large number of constructs didn't seem
to be tested before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229748 91177308-0d34-0410-b5e6-96231b3b80d8
27 files changed:
include/clang/AST/Stmt.h
lib/CodeGen/CoverageMappingGen.cpp
test/CoverageMapping/Inputs/code.h
test/CoverageMapping/Inputs/ends_a_scope [new file with mode: 0644]
test/CoverageMapping/Inputs/md.def [new file with mode: 0644]
test/CoverageMapping/Inputs/starts_a_scope [new file with mode: 0644]
test/CoverageMapping/break.c
test/CoverageMapping/continue.c
test/CoverageMapping/header.cpp
test/CoverageMapping/includehell.cpp
test/CoverageMapping/label.cpp
test/CoverageMapping/loopmacro.c
test/CoverageMapping/loops.cpp
test/CoverageMapping/macro-expansion.c [new file with mode: 0644]
test/CoverageMapping/macro-expressions.cpp [new file with mode: 0644]
test/CoverageMapping/macroception.c
test/CoverageMapping/macroparams.c
test/CoverageMapping/macroparams2.c
test/CoverageMapping/macros.c
test/CoverageMapping/macroscopes.cpp [new file with mode: 0644]
test/CoverageMapping/md.cpp [new file with mode: 0644]
test/CoverageMapping/moremacros.c [new file with mode: 0644]
test/CoverageMapping/return.c
test/CoverageMapping/switch.c
test/CoverageMapping/switchmacro.c [new file with mode: 0644]
test/CoverageMapping/trycatch.cpp
test/CoverageMapping/while.c [new file with mode: 0644]