Vedant Kumar efd319a2ad [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.

llvm-svn: 276716
2016-07-26 00:24:59 +00:00

27 lines
638 B
C++

// RUN: %clang_cc1 -std=c++11 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name system_macro.cpp -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
}
// CHECK-LABEL: main
int main() { // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+2]]:2 = #0
Func([] { return true; }());
}
#endif