summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist62
-rw-r--r--clang/test/Analysis/diagnostics/Inputs/expected-plists/deref-track-symbolic-region.c.plist8
-rw-r--r--clang/test/Analysis/diagnostics/deref-track-symbolic-region.c8
-rw-r--r--clang/test/Analysis/diagnostics/dtors.cpp9
-rw-r--r--clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist4
-rw-r--r--clang/test/Analysis/inlining/path-notes.cpp2
-rw-r--r--clang/test/Analysis/null-deref-path-notes.cpp2
-rw-r--r--clang/test/Analysis/osobject-retain-release.cpp8
-rw-r--r--clang/test/Analysis/uninit-vals.m17
9 files changed, 95 insertions, 25 deletions
diff --git a/clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist b/clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist
index 4eca510c3f0..b4c79018c66 100644
--- a/clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist
+++ b/clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist
@@ -22230,6 +22230,68 @@
<key>end</key>
<array>
<dict>
+ <key>line</key><integer>587</integer>
+ <key>col</key><integer>11</integer>
+ <key>file</key><integer>0</integer>
+ </dict>
+ <dict>
+ <key>line</key><integer>587</integer>
+ <key>col</key><integer>11</integer>
+ <key>file</key><integer>0</integer>
+ </dict>
+ </array>
+ </dict>
+ </array>
+ </dict>
+ <dict>
+ <key>kind</key><string>pop-up</string>
+ <key>location</key>
+ <dict>
+ <key>line</key><integer>587</integer>
+ <key>col</key><integer>11</integer>
+ <key>file</key><integer>0</integer>
+ </dict>
+ <key>ranges</key>
+ <array>
+ <array>
+ <dict>
+ <key>line</key><integer>587</integer>
+ <key>col</key><integer>11</integer>
+ <key>file</key><integer>0</integer>
+ </dict>
+ <dict>
+ <key>line</key><integer>587</integer>
+ <key>col</key><integer>16</integer>
+ <key>file</key><integer>0</integer>
+ </dict>
+ </array>
+ </array>
+ <key>extended_message</key>
+ <string>Field &apos;b&apos; is equal to 2</string>
+ <key>message</key>
+ <string>Field &apos;b&apos; is equal to 2</string>
+ </dict>
+ <dict>
+ <key>kind</key><string>control</string>
+ <key>edges</key>
+ <array>
+ <dict>
+ <key>start</key>
+ <array>
+ <dict>
+ <key>line</key><integer>587</integer>
+ <key>col</key><integer>11</integer>
+ <key>file</key><integer>0</integer>
+ </dict>
+ <dict>
+ <key>line</key><integer>587</integer>
+ <key>col</key><integer>11</integer>
+ <key>file</key><integer>0</integer>
+ </dict>
+ </array>
+ <key>end</key>
+ <array>
+ <dict>
<key>line</key><integer>588</integer>
<key>col</key><integer>9</integer>
<key>file</key><integer>0</integer>
diff --git a/clang/test/Analysis/diagnostics/Inputs/expected-plists/deref-track-symbolic-region.c.plist b/clang/test/Analysis/diagnostics/Inputs/expected-plists/deref-track-symbolic-region.c.plist
index 35b14fba4c8..47c3b8df09c 100644
--- a/clang/test/Analysis/diagnostics/Inputs/expected-plists/deref-track-symbolic-region.c.plist
+++ b/clang/test/Analysis/diagnostics/Inputs/expected-plists/deref-track-symbolic-region.c.plist
@@ -165,9 +165,9 @@
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
- <string>Assuming pointer value is null</string>
+ <string>Assuming field &apos;x&apos; is null</string>
<key>message</key>
- <string>Assuming pointer value is null</string>
+ <string>Assuming field &apos;x&apos; is null</string>
</dict>
<dict>
<key>kind</key><string>control</string>
@@ -454,9 +454,9 @@
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
- <string>Assuming pointer value is null</string>
+ <string>Assuming field &apos;x&apos; is null</string>
<key>message</key>
- <string>Assuming pointer value is null</string>
+ <string>Assuming field &apos;x&apos; is null</string>
</dict>
<dict>
<key>kind</key><string>control</string>
diff --git a/clang/test/Analysis/diagnostics/deref-track-symbolic-region.c b/clang/test/Analysis/diagnostics/deref-track-symbolic-region.c
index 63d0971b85d..1a1190f934d 100644
--- a/clang/test/Analysis/diagnostics/deref-track-symbolic-region.c
+++ b/clang/test/Analysis/diagnostics/deref-track-symbolic-region.c
@@ -15,8 +15,8 @@ void test(struct S syz, int *pp) {
struct S *ps = &syz;
if (ps->x)
- //expected-note@-1{{Taking false branch}}
- //expected-note@-2{{Assuming pointer value is null}}
+ //expected-note@-1{{Assuming field 'x' is null}}
+ //expected-note@-2{{Taking false branch}}
m++;
@@ -30,8 +30,8 @@ void testTrackConstraintBRVisitorIsTrackingTurnedOn(struct S syz, int *pp) {
struct S *ps = &syz;
if (ps->x)
- //expected-note@-1{{Taking false branch}}
- //expected-note@-2{{Assuming pointer value is null}}
+ //expected-note@-1{{Assuming field 'x' is null}}
+ //expected-note@-2{{Taking false branch}}
m++;
int *p = syz.x; //expected-note {{'p' initialized to a null pointer value}}
diff --git a/clang/test/Analysis/diagnostics/dtors.cpp b/clang/test/Analysis/diagnostics/dtors.cpp
index b3fe7ec803a..18bedc61f98 100644
--- a/clang/test/Analysis/diagnostics/dtors.cpp
+++ b/clang/test/Analysis/diagnostics/dtors.cpp
@@ -16,10 +16,11 @@ struct smart_ptr {
S *s;
smart_ptr(S *);
S *get() {
- return (x || 0) ? nullptr : s; // expected-note{{Left side of '||' is false}}
- // expected-note@-1{{'?' condition is false}}
- // expected-warning@-2{{Use of memory after it is freed}}
- // expected-note@-3{{Use of memory after it is freed}}
+ return (x || 0) ? nullptr : s; // expected-note{{Field 'x' is 0}}
+ // expected-note@-1{{Left side of '||' is false}}
+ // expected-note@-2{{'?' condition is false}}
+ // expected-warning@-3{{Use of memory after it is freed}}
+ // expected-note@-4{{Use of memory after it is freed}}
}
};
diff --git a/clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist b/clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist
index f517d4dddbc..c9fd8c848bd 100644
--- a/clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist
+++ b/clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist
@@ -4271,9 +4271,9 @@
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
- <string>Assuming pointer value is null</string>
+ <string>Assuming field &apos;arr&apos; is null</string>
<key>message</key>
- <string>Assuming pointer value is null</string>
+ <string>Assuming field &apos;arr&apos; is null</string>
</dict>
<dict>
<key>kind</key><string>control</string>
diff --git a/clang/test/Analysis/inlining/path-notes.cpp b/clang/test/Analysis/inlining/path-notes.cpp
index 43859237438..ef56cc76f82 100644
--- a/clang/test/Analysis/inlining/path-notes.cpp
+++ b/clang/test/Analysis/inlining/path-notes.cpp
@@ -231,7 +231,7 @@ struct Owner {
};
void Owner::testGetDerefExprOnMemberExprWithADot() {
- if (arr) // expected-note {{Assuming pointer value is null}}
+ if (arr) // expected-note {{Assuming field 'arr' is null}}
// expected-note@-1 {{Taking false branch}}
;
arr[1].x = 1; //expected-warning {{Dereference of null pointer}}
diff --git a/clang/test/Analysis/null-deref-path-notes.cpp b/clang/test/Analysis/null-deref-path-notes.cpp
index dd54b24e784..c7b0619e297 100644
--- a/clang/test/Analysis/null-deref-path-notes.cpp
+++ b/clang/test/Analysis/null-deref-path-notes.cpp
@@ -19,7 +19,7 @@ void c::f(B &g, int &i) {
// expected-note@-1{{Array access (via field 'd') results in a null pointer dereference}}
B h, a; // expected-note{{Value assigned to 'h.d'}}
a.d == __null; // expected-note{{Assuming the condition is true}}
- a.d != h.d; // expected-note{{Assuming pointer value is null}}
+ a.d != h.d; // expected-note{{Assuming 'a.d' is equal to 'h.d'}}
f(h, b); // expected-note{{Calling 'c::f'}}
}
}
diff --git a/clang/test/Analysis/osobject-retain-release.cpp b/clang/test/Analysis/osobject-retain-release.cpp
index 9d7cd854422..10ef144bf36 100644
--- a/clang/test/Analysis/osobject-retain-release.cpp
+++ b/clang/test/Analysis/osobject-retain-release.cpp
@@ -601,16 +601,18 @@ void test_smart_ptr_uaf() {
{
OSObjectPtr p(obj); // expected-note{{Calling constructor for 'smart_ptr<OSObject>'}}
// expected-note@-1{{Returning from constructor for 'smart_ptr<OSObject>'}}
+ // expected-note@os_smart_ptr.h:13{{Field 'pointer' is non-null}}
// expected-note@os_smart_ptr.h:13{{Taking true branch}}
// expected-note@os_smart_ptr.h:14{{Calling 'smart_ptr::_retain'}}
// expected-note@os_smart_ptr.h:71{{Reference count incremented. The object now has a +2 retain count}}
// expected-note@os_smart_ptr.h:14{{Returning from 'smart_ptr::_retain'}}
} // expected-note{{Calling '~smart_ptr'}}
+ // expected-note@os_smart_ptr.h:35{{Field 'pointer' is non-null}}
// expected-note@os_smart_ptr.h:35{{Taking true branch}}
// expected-note@os_smart_ptr.h:36{{Calling 'smart_ptr::_release'}}
// expected-note@os_smart_ptr.h:76{{Reference count decremented. The object now has a +1 retain count}}
// expected-note@os_smart_ptr.h:36{{Returning from 'smart_ptr::_release'}}
- // expected-note@-5{{Returning from '~smart_ptr'}}
+ // expected-note@-6{{Returning from '~smart_ptr'}}
obj->release(); // expected-note{{Object released}}
obj->release(); // expected-warning{{Reference-counted object is used after it is released}}
// expected-note@-1{{Reference-counted object is used after it is released}}
@@ -621,16 +623,18 @@ void test_smart_ptr_leak() {
{
OSObjectPtr p(obj); // expected-note{{Calling constructor for 'smart_ptr<OSObject>'}}
// expected-note@-1{{Returning from constructor for 'smart_ptr<OSObject>'}}
+ // expected-note@os_smart_ptr.h:13{{Field 'pointer' is non-null}}
// expected-note@os_smart_ptr.h:13{{Taking true branch}}
// expected-note@os_smart_ptr.h:14{{Calling 'smart_ptr::_retain'}}
// expected-note@os_smart_ptr.h:71{{Reference count incremented. The object now has a +2 retain count}}
// expected-note@os_smart_ptr.h:14{{Returning from 'smart_ptr::_retain'}}
} // expected-note{{Calling '~smart_ptr'}}
+ // expected-note@os_smart_ptr.h:35{{Field 'pointer' is non-null}}
// expected-note@os_smart_ptr.h:35{{Taking true branch}}
// expected-note@os_smart_ptr.h:36{{Calling 'smart_ptr::_release'}}
// expected-note@os_smart_ptr.h:76{{Reference count decremented. The object now has a +1 retain count}}
// expected-note@os_smart_ptr.h:36{{Returning from 'smart_ptr::_release'}}
- // expected-note@-5{{Returning from '~smart_ptr'}}
+ // expected-note@-6{{Returning from '~smart_ptr'}}
} // expected-warning{{Potential leak of an object stored into 'obj'}}
// expected-note@-1{{Object leaked: object allocated and stored into 'obj' is not referenced later in this execution path and has a retain count of +1}}
diff --git a/clang/test/Analysis/uninit-vals.m b/clang/test/Analysis/uninit-vals.m
index 5b959c7bfe1..b59f72b1077 100644
--- a/clang/test/Analysis/uninit-vals.m
+++ b/clang/test/Analysis/uninit-vals.m
@@ -164,7 +164,7 @@ void PR14765_test() {
// expected-note@-1{{TRUE}}
testObj->origin = makePoint(0.0, 0.0);
- if (testObj->size > 0) { ; } // expected-note{{Assuming the condition is false}}
+ if (testObj->size > 0) { ; } // expected-note{{Assuming field 'size' is <= 0}}
// expected-note@-1{{Taking false branch}}
// FIXME: Assigning to 'testObj->origin' kills the default binding for the
@@ -219,13 +219,13 @@ void PR14765_test_int() {
// expected-note@-1{{TRUE}}
testObj->origin = makeIntPoint(1, 2);
- if (testObj->size > 0) { ; } // expected-note{{Assuming the condition is false}}
+ if (testObj->size > 0) { ; } // expected-note{{Assuming field 'size' is <= 0}}
// expected-note@-1{{Taking false branch}}
- // expected-note@-2{{Assuming the condition is false}}
+ // expected-note@-2{{Assuming field 'size' is <= 0}}
// expected-note@-3{{Taking false branch}}
- // expected-note@-4{{Assuming the condition is false}}
+ // expected-note@-4{{Assuming field 'size' is <= 0}}
// expected-note@-5{{Taking false branch}}
- // expected-note@-6{{Assuming the condition is false}}
+ // expected-note@-6{{Assuming field 'size' is <= 0}}
// expected-note@-7{{Taking false branch}}
// FIXME: Assigning to 'testObj->origin' kills the default binding for the
@@ -321,9 +321,12 @@ void testSmallStructInLargerStruct() {
// expected-note@-1{{TRUE}}
testObj->origin = makeIntPoint2D(1, 2);
- if (testObj->size > 0) { ; } // expected-note{{Taking false branch}}
+ if (testObj->size > 0) { ; } // expected-note{{Field 'size' is <= 0}}
// expected-note@-1{{Taking false branch}}
- // expected-note@-2{{Taking false branch}}
+ // expected-note@-2{{Field 'size' is <= 0}}
+ // expected-note@-3{{Taking false branch}}
+ // expected-note@-4{{Field 'size' is <= 0}}
+ // expected-note@-5{{Taking false branch}}
clang_analyzer_eval(testObj->size == 0); // expected-warning{{TRUE}}
// expected-note@-1{{TRUE}}
OpenPOWER on IntegriCloud