[llvm-branch-commits] [cfe-branch] r276801 - Merging r276716:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jul 26 13:47:37 PDT 2016
Author: hans
Date: Tue Jul 26 15:47:37 2016
New Revision: 276801
URL: http://llvm.org/viewvc/llvm-project?rev=276801&view=rev
Log:
Merging r276716:
------------------------------------------------------------------------
r276716 | vedantk | 2016-07-25 17:24:59 -0700 (Mon, 25 Jul 2016) | 10 lines
[Coverage] Do not write out coverage mappings with zero entries
After r275121, we stopped mapping regions from system headers. Lambdas
declared in regions belonging to system headers started producing empty
coverage mappings, since the files corresponding to their spelling locs
were being ignored.
The coverage reader doesn't know what to do with these empty mappings.
This commit makes sure that we don't produce them and adds a test. I'll
make the reader stricter in a follow-up commit.
------------------------------------------------------------------------
Added:
cfe/branches/release_39/test/CoverageMapping/system_macro.cpp
- copied unchanged from r276716, cfe/trunk/test/CoverageMapping/system_macro.cpp
Removed:
cfe/branches/release_39/test/CoverageMapping/system_macro.c
Modified:
cfe/branches/release_39/ (props changed)
cfe/branches/release_39/lib/CodeGen/CoverageMappingGen.cpp
Propchange: cfe/branches/release_39/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 26 15:47:37 2016
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:275880,275967,276361,276473
+/cfe/trunk:275880,275967,276361,276473,276716
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_39/lib/CodeGen/CoverageMappingGen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/CodeGen/CoverageMappingGen.cpp?rev=276801&r1=276800&r2=276801&view=diff
==============================================================================
--- cfe/branches/release_39/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/branches/release_39/lib/CodeGen/CoverageMappingGen.cpp Tue Jul 26 15:47:37 2016
@@ -351,6 +351,9 @@ struct EmptyCoverageMappingBuilder : pub
gatherFileIDs(FileIDMapping);
emitSourceRegions();
+ if (MappingRegions.empty())
+ return;
+
CoverageMappingWriter Writer(FileIDMapping, None, MappingRegions);
Writer.write(OS);
}
@@ -604,6 +607,9 @@ struct CounterCoverageMappingBuilder
emitExpansionRegions();
gatherSkippedRegions();
+ if (MappingRegions.empty())
+ return;
+
CoverageMappingWriter Writer(VirtualFileMapping, Builder.getExpressions(),
MappingRegions);
Writer.write(OS);
@@ -620,6 +626,11 @@ struct CounterCoverageMappingBuilder
void VisitDecl(const Decl *D) {
Stmt *Body = D->getBody();
+
+ // Do not propagate region counts into system headers.
+ if (Body && SM.isInSystemHeader(SM.getSpellingLoc(getStart(Body))))
+ return;
+
propagateCounts(getRegionCounter(Body), Body);
}
Removed: cfe/branches/release_39/test/CoverageMapping/system_macro.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/CoverageMapping/system_macro.c?rev=276800&view=auto
==============================================================================
--- cfe/branches/release_39/test/CoverageMapping/system_macro.c (original)
+++ cfe/branches/release_39/test/CoverageMapping/system_macro.c (removed)
@@ -1,23 +0,0 @@
-// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name system_macro.c -o - %s | FileCheck %s
-
-#ifdef IS_SYSHEADER
-
-#pragma clang system_header
-#define Func(x) if (x) {}
-#define SomeType int
-
-#else
-
-#define IS_SYSHEADER
-#include __FILE__
-
-// CHECK-LABEL: doSomething:
-void doSomething(int x) { // CHECK: File 0, [[@LINE]]:25 -> {{[0-9:]+}} = #0
- Func(x);
- return;
- SomeType *f; // CHECK: File 0, [[@LINE]]:11 -> {{[0-9:]+}} = 0
-}
-
-int main() {}
-
-#endif
More information about the llvm-branch-commits
mailing list