[clang-tidy] Fix crash on end location inside macro
authorNathan Huckleberry <nhuck@google.com>
Wed, 17 Jul 2019 17:22:43 +0000 (17:22 +0000)
committerNathan Huckleberry <nhuck@google.com>
Wed, 17 Jul 2019 17:22:43 +0000 (17:22 +0000)
commitb53e13cd43e8aacf26222186b241346484962a21
tree7b986227f64fe5307fb09411bdb291d9fea83ecb
parentdce1954f455fc35ea3586f342db5077d505f1057
[clang-tidy] Fix crash on end location inside macro

Summary:
Lexer::getLocForEndOfToken is defined to return an
invalid location if the given location is inside a macro.
Other checks conditionally warn based off location
validity. Updating this check to do the same.

Reviewers: JonasToth, aaron.ballman, nickdesaulniers

Reviewed By: nickdesaulniers

Subscribers: lebedev.ri, nickdesaulniers, xazax.hun, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64607

llvm-svn: 366353
clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp
clang-tools-extra/test/clang-tidy/bugprone-branch-clone-macro-crash.c [new file with mode: 0644]