2011-03-01 03:49:42 +08:00
|
|
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s
|
2011-02-19 04:55:19 +08:00
|
|
|
|
|
|
|
int f1(char *dst) {
|
|
|
|
char *p = dst + 4;
|
|
|
|
char *q = dst + 3;
|
|
|
|
return !(q >= p);
|
|
|
|
}
|
2011-02-19 05:24:56 +08:00
|
|
|
|
2011-02-19 09:08:41 +08:00
|
|
|
long f2(char *c) {
|
|
|
|
return long(c) & 1;
|
|
|
|
}
|
|
|
|
|
2011-02-19 09:59:41 +08:00
|
|
|
bool f3() {
|
|
|
|
return !false;
|
|
|
|
}
|
|
|
|
|
2011-02-19 16:03:18 +08:00
|
|
|
void *f4(int* w) {
|
|
|
|
return reinterpret_cast<void*&>(w);
|
|
|
|
}
|
|
|
|
|
2011-02-19 05:24:56 +08:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
struct A { };
|
|
|
|
struct B {
|
2011-02-19 10:53:41 +08:00
|
|
|
operator A() { return A(); }
|
2011-02-19 05:24:56 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
A f(char *dst) {
|
|
|
|
B b;
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2011-02-19 16:03:18 +08:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
struct S {
|
|
|
|
void *p;
|
|
|
|
};
|
|
|
|
|
|
|
|
void *f(S* w) {
|
|
|
|
return &reinterpret_cast<void*&>(*w);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2011-03-26 22:30:44 +08:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
struct C {
|
|
|
|
void *p;
|
|
|
|
static void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
void C::f() { }
|
|
|
|
|
|
|
|
}
|