aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/initializer.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2013-03-07 03:02:36 +0000
committerAnna Zaks <ganna@apple.com>2013-03-07 03:02:36 +0000
commit018e9aa033ff7363797c62fc3b14669d0558284b (patch)
tree725c416f4067066e9ea95f0437889b299e1cb5fb /test/Analysis/initializer.cpp
parentcf048a80ed610262fd634d421ea65ff936901b36 (diff)
[analyzer] Warn on passing a reference to null pointer as an argument in a call
Warn about null pointer dereference earlier when a reference to a null pointer is passed in a call. The idea is that even though the standard might allow this, reporting the issue earlier is better for diagnostics (the error is reported closer to the place where the pointer was set to NULL). This also simplifies analyzer’s diagnostic logic, which has to track “where the null came from”. As a consequence, some of our null pointer warning suppression mechanisms started triggering more often. TODO: Change the name of the file and class to reflect the new check. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176612 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/initializer.cpp')
-rw-r--r--test/Analysis/initializer.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/test/Analysis/initializer.cpp b/test/Analysis/initializer.cpp
index ab2eb90143..3f7802c56d 100644
--- a/test/Analysis/initializer.cpp
+++ b/test/Analysis/initializer.cpp
@@ -68,8 +68,7 @@ void testReferenceMember() {
void testReferenceMember2() {
int *p = 0;
- // FIXME: We should warn here, since we're creating the reference here.
- RefWrapper X(*p); // expected-warning@-12 {{Dereference of null pointer}}
+ RefWrapper X(*p); // expected-warning {{Forming reference to null pointer}}
}