]> granicus.if.org Git - clang/commit
InstrProf: Handle whitespace and comments at the ends of macros
authorJustin Bogner <mail@justinbogner.com>
Wed, 25 Mar 2015 04:13:49 +0000 (04:13 +0000)
committerJustin Bogner <mail@justinbogner.com>
Wed, 25 Mar 2015 04:13:49 +0000 (04:13 +0000)
commit293a0c4d8d42bbfd7fad1303a0b632e906c3435f
treea7b373fa3fb8d2aaf5639ed2a94b400c50796631
parent7d4ac8c812a9f9f201020ec83d6b4ad6ad215f23
InstrProf: Handle whitespace and comments at the ends of macros

When we try to find the end loc for a token, we have to re-lex the
token. This was running into a problem when we'd store the end loc of
a macro's coverage region, since we wouldn't actually be at the
beginning of a token when we tried to re-lex it, leading us to do
silly things (and eventually assert) when whitespace or comments
followed.

This pushes our use of getPreciseTokenLocEnd earlier, so that we won't
call it when it doesn't make sense to. It also removes an unnecessary
adjustment by 1 that was working around this problem in some cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233169 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CoverageMappingGen.cpp
test/CoverageMapping/comment-in-macro.c [new file with mode: 0644]