teak-llvm/clang/test/CoverageMapping/include-macros.c
Vedant Kumar 95a2a7f2a1 [Lexer] Don't merge macro args from different macro files
The lexer sets the end location of macro arguments incorrectly *if*,
while merging consecutive args to fit into a single SLocEntry, it finds
args which come from different macro files.

Fix the issue by using separate SLocEntries in this situation.

This fixes a code coverage crasher (rdar://problem/26181005). Because
the lexer reported end locations for certain macro args incorrectly, we
would generate bogus coverage mappings with negative line offsets.

Reviewed-by: akyrtzi

Differential Revision: http://reviews.llvm.org/D20401

llvm-svn: 270160
2016-05-19 23:44:02 +00:00

19 lines
747 B
C

// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name include-macros.c %s | FileCheck %s
#include "Inputs/macros.h"
void f1() {
M2("a", "b");
}
// CHECK-LABEL: f1:
// CHECK-NEXT: File 0, 5:11 -> 7:2 = #0
// CHECK-NEXT: Expansion,File 0, 6:3 -> 6:5 = #0 (Expanded file = 1)
// CHECK-NEXT: File 1, 13:20 -> 13:50 = #0
// CHECK-NEXT: Expansion,File 1, 13:20 -> 13:22 = #0 (Expanded file = 2)
// CHECK-NEXT: File 2, 7:20 -> 7:46 = #0
// CHECK-NEXT: Expansion,File 2, 7:33 -> 7:44 = #0 (Expanded file = 3)
// CHECK-NEXT: File 3, 13:26 -> 13:34 = #0
// CHECK-NEXT: Expansion,File 3, 13:26 -> 13:33 = #0 (Expanded file = 4)
// CHECK-NEXT: File 4, 3:17 -> 3:18 = #0