[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Analysis / new-ctor-symbolic.cpp
blobbe43791512782ea5f440a9b8a4f36459a583da99
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config c++-allocator-inlining=true -std=c++11 -verify -analyzer-config eagerly-assume=false %s
3 void clang_analyzer_eval(bool);
4 void clang_analyzer_warnOnDeadSymbol(int);
6 typedef __typeof__(sizeof(int)) size_t;
8 int conjure();
9 void exit(int);
11 struct S {
12 S() {}
13 ~S() {}
15 static S buffer[1000];
17 // This operator allocates stuff within the buffer. Additionally, it never
18 // places anything at the beginning of the buffer.
19 void *operator new(size_t size) {
20 int i = conjure();
21 if (i == 0)
22 exit(1);
23 // Let's see if the symbol dies before new-expression is evaluated.
24 // It shouldn't.
25 clang_analyzer_warnOnDeadSymbol(i);
26 return buffer + i;
30 void testIndexLiveness() {
31 S *s = new S();
32 clang_analyzer_eval(s == S::buffer); // expected-warning{{FALSE}}
33 } // expected-warning{{SYMBOL DEAD}}