summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-07-11 22:57:46 +0000
committerVedant Kumar <vsk@apple.com>2016-07-11 22:57:46 +0000
commit93205af066341a53733046894bd75c72c99566db (patch)
treeec37ba1e93ec19bd76803b44084f0e0ef15286c5 /clang/lib/CodeGen
parentc468bb8b290e73b45836d87d7de32068e8d2ae40 (diff)
downloadbcm5719-llvm-93205af066341a53733046894bd75c72c99566db.tar.gz
bcm5719-llvm-93205af066341a53733046894bd75c72c99566db.zip
[Coverage] Do not map regions from system headers
Do not assign source regions located within system headers file ID's, and do not construct counter mapping regions out of them. This makes coverage reports less cluttered and less mysterious. E.g using the "assert" macro doesn't cause assert.h to appear in reports, and it no longer shows the "assertion failed" branch as an uncovered region. It also makes coverage mapping sections a bit smaller (e.g a 1% reduction in a stage2 build of bin/llvm-as). llvm-svn: 275121
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CoverageMappingGen.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index 7055e3a3568..b4dd1a93032 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -172,6 +172,10 @@ public:
if (!Visited.insert(File).second)
continue;
+ // Do not map FileID's associated with system headers.
+ if (SM.isInSystemHeader(SM.getSpellingLoc(Loc)))
+ continue;
+
unsigned Depth = 0;
for (SourceLocation Parent = getIncludeOrExpansionLoc(Loc);
Parent.isValid(); Parent = getIncludeOrExpansionLoc(Parent))
@@ -251,6 +255,10 @@ public:
SourceLocation LocStart = Region.getStartLoc();
assert(SM.getFileID(LocStart).isValid() && "region in invalid file");
+ // Ignore regions from system headers.
+ if (SM.isInSystemHeader(SM.getSpellingLoc(LocStart)))
+ continue;
+
auto CovFileID = getCoverageFileID(LocStart);
// Ignore regions that don't have a file, such as builtin macros.
if (!CovFileID)
OpenPOWER on IntegriCloud