[analyzer] LoopUnrolling: fix crash when a parameter is a loop counter.
authorArtem Dergachev <artem.dergachev@gmail.com>
Fri, 22 May 2020 11:53:59 +0000 (14:53 +0300)
committerArtem Dergachev <artem.dergachev@gmail.com>
Fri, 22 May 2020 13:14:48 +0000 (16:14 +0300)
commit99b94f29ac5dbbce0585d16f631359a66f279ea4
tree72e458513883dfa2f87106d01eb0bf18848bad0f
parent880df559f9dc4fca6c8c8cfb6676a95a6c3c9ca5
[analyzer] LoopUnrolling: fix crash when a parameter is a loop counter.

When loop counter is a function parameter "isPossiblyEscaped" will not find
the variable declaration which lead to hitting "llvm_unreachable".
Parameters of reference type should be escaped like global variables;
otherwise treat them as unescaped.

Patch by Abbas Sabra!

Differential Revision: https://reviews.llvm.org/D80171
clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp
clang/test/Analysis/loop-unrolling.cpp