2010-02-05 01:06:52 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -O3 | FileCheck %s
|
2009-11-21 01:27:56 +08:00
|
|
|
|
2010-02-05 01:06:52 +08:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
static int counter;
|
|
|
|
|
|
|
|
struct A {
|
|
|
|
A() : i(0) { counter++; }
|
|
|
|
~A() { counter--; }
|
2009-11-21 01:27:56 +08:00
|
|
|
int i;
|
|
|
|
};
|
|
|
|
|
2010-02-05 01:06:52 +08:00
|
|
|
void g(int) { }
|
2009-11-21 01:27:56 +08:00
|
|
|
|
2010-02-05 01:06:52 +08:00
|
|
|
void f1(bool b) {
|
|
|
|
g(b ? A().i : 0);
|
|
|
|
g(b || A().i);
|
|
|
|
g(b && A().i);
|
|
|
|
}
|
2009-11-21 01:27:56 +08:00
|
|
|
|
2010-02-05 01:06:52 +08:00
|
|
|
struct Checker {
|
|
|
|
Checker() {
|
|
|
|
f1(true);
|
|
|
|
f1(false);
|
|
|
|
}
|
|
|
|
};
|
2009-11-21 01:27:56 +08:00
|
|
|
|
2010-02-05 01:06:52 +08:00
|
|
|
Checker c;
|
|
|
|
|
|
|
|
}
|
2009-11-21 01:27:56 +08:00
|
|
|
|
2010-02-05 01:06:52 +08:00
|
|
|
// CHECK: define i32 @_Z10getCounterv()
|
|
|
|
int getCounter() {
|
|
|
|
// CHECK: ret i32 0
|
|
|
|
return counter;
|
2009-11-21 01:27:56 +08:00
|
|
|
}
|