llvm-capstone/clang/test/Analysis/loop-widening-ignore-static-methods.cpp
Matt Davis 95dd80c2e8 [analyzer] Avoid querying this-pointers for static-methods.
Summary:
The loop-widening code processes c++ methods looking for `this` pointers.  In
the case of static methods (which do not have `this` pointers), an assertion
was triggering.   This patch avoids trying to process `this` pointers for
static methods, and thus avoids triggering the assertion .


Reviewers: dcoughlin, george.karpenkov, NoQ

Reviewed By: NoQ

Subscribers: NoQ, xazax.hun, szepet, a.sidorin, mikhail.ramalho, cfe-commits

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

llvm-svn: 339201
2018-08-07 23:13:28 +00:00

13 lines
351 B
C++

// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-config widen-loops=true -analyzer-max-loop 2 %s
// REQUIRES: asserts
// expected-no-diagnostics
//
// This test checks that the loop-widening code ignores static methods. If that is not the
// case, then an assertion will trigger.
class Test {
static void foo() {
for (;;) {}
}
};