]> granicus.if.org Git - clang/commit
[Lexer] Don't merge macro args from different macro files
authorVedant Kumar <vsk@apple.com>
Thu, 19 May 2016 23:44:02 +0000 (23:44 +0000)
committerVedant Kumar <vsk@apple.com>
Thu, 19 May 2016 23:44:02 +0000 (23:44 +0000)
commitb384460fc34b2d2134efc649f3ac087126533ba9
tree85037a70ea5c4c3e4d978da6089e00c7324a595e
parent23d62c03a7d342acec33d43091e70d1b60ec5b0a
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270160 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Lex/TokenLexer.cpp
test/CoverageMapping/Inputs/macros.h [new file with mode: 0644]
test/CoverageMapping/include-macros.c [new file with mode: 0644]
unittests/Lex/LexerTest.cpp