llvm-capstone/clang/test/Analysis/base-init.cpp
Jordan Rose 219c9d0dd3 [analyzer] Though C++ inlining is enabled, don't inline ctors and dtors.
More generally, this adds a new configuration option 'c++-inlining', which
controls which C++ member functions can be considered for inlining. This
uses the new -analyzer-config table, so the cc1 arguments will look like this:

... -analyzer-config c++-inlining=[none|methods|constructors|destructors]

Note that each mode implies that all the previous member function kinds
will be inlined as well; it doesn't make sense to inline destructors
without inlining constructors, for example.

The default mode is 'methods'.

llvm-svn: 163004
2012-08-31 17:06:49 +00:00

30 lines
426 B
C++

// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-ipa=inlining -analyzer-config c++-inlining=constructors -verify %s
void clang_analyzer_eval(bool);
class A {
int x;
public:
A();
int getx() const {
return x;
}
};
A::A() : x(0) {
}
class B : public A {
int y;
public:
B();
};
B::B() {
}
void f() {
B b;
clang_analyzer_eval(b.getx() == 0); // expected-warning{{TRUE}}
}