[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / Analysis / loop-widening-preserve-reference-type.cpp
blob38dcb4fbb6acf49ca3e8d12db9040fac9e7559f9
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc,debug.ExprInspection -analyzer-max-loop 4 -analyzer-config widen-loops=true -verify %s
3 void clang_analyzer_eval(int);
5 struct A {
6 ~A() {}
7 };
8 struct B : public A {};
10 void invalid_type_region_access() {
11 const A &x = B();
12 for (int i = 0; i < 10; ++i) { }
13 clang_analyzer_eval(&x != 0); // expected-warning{{TRUE}}
14 } // expected-warning@-1{{reference cannot be bound to dereferenced null pointer in well-defined C++ code; comparison may be assumed to always evaluate to true}}
16 using AR = const A &;
17 void invalid_type_alias_region_access() {
18 AR x = B();
19 for (int i = 0; i < 10; ++i) {
21 clang_analyzer_eval(&x != 0); // expected-warning{{TRUE}}
22 } // expected-warning@-1{{reference cannot be bound to dereferenced null pointer in well-defined C++ code; comparison may be assumed to always evaluate to true}}