forked from OSchip/llvm-project
parent
28783da044
commit
731b501981
|
@ -2402,10 +2402,10 @@ def warn_impcast_pointer_to_bool : Warning<
|
|||
InGroup<PointerBoolConversion>;
|
||||
def warn_this_bool_conversion : Warning<
|
||||
"'this' pointer cannot be null in well-defined C++ code; pointer may be "
|
||||
"assumed always converted to true">, InGroup<UndefinedBoolConversion>;
|
||||
"assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
|
||||
def warn_address_of_reference_bool_conversion : Warning<
|
||||
"reference cannot be bound to dereferenced null pointer in well-defined C++ "
|
||||
"code; pointer may be assumed always converted to true">,
|
||||
"code; pointer may be assumed to always convert to true">,
|
||||
InGroup<UndefinedBoolConversion>;
|
||||
|
||||
def warn_null_pointer_compare : Warning<
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
void test1(int &x) {
|
||||
if (x == 1) { }
|
||||
if (&x) { }
|
||||
// expected-warning@-1{{reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed always converted to true}}
|
||||
// expected-warning@-1{{reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true}}
|
||||
|
||||
if (!&x) { }
|
||||
// expected-warning@-1{{reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed always converted to true}}
|
||||
// expected-warning@-1{{reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true}}
|
||||
}
|
||||
|
||||
class test2 {
|
||||
|
@ -17,19 +17,19 @@ class test2 {
|
|||
|
||||
void foo() {
|
||||
if (this) { }
|
||||
// expected-warning@-1{{'this' pointer cannot be null in well-defined C++ code; pointer may be assumed always converted to true}}
|
||||
// expected-warning@-1{{'this' pointer cannot be null in well-defined C++ code; pointer may be assumed to always convert to true}}
|
||||
|
||||
if (!this) { }
|
||||
// expected-warning@-1{{'this' pointer cannot be null in well-defined C++ code; pointer may be assumed always converted to true}}
|
||||
// expected-warning@-1{{'this' pointer cannot be null in well-defined C++ code; pointer may be assumed to always convert to true}}
|
||||
}
|
||||
|
||||
void bar() {
|
||||
if (x == 1) { }
|
||||
if (&x) { }
|
||||
// expected-warning@-1{{reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed always converted to true}}
|
||||
// expected-warning@-1{{reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true}}
|
||||
|
||||
if (!&x) { }
|
||||
// expected-warning@-1{{reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed always converted to true}}
|
||||
// expected-warning@-1{{reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true}}
|
||||
}
|
||||
|
||||
int &x;
|
||||
|
|
Loading…
Reference in New Issue