summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/method-call-path-notes.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-10-25 22:07:10 +0000
committerTed Kremenek <kremenek@apple.com>2012-10-25 22:07:10 +0000
commita5958869f6bcd57e8691e6c4fb4086a96c17e419 (patch)
treed6a8d4bd01756396b48b21e4094d6266405b86e7 /clang/test/Analysis/method-call-path-notes.cpp
parent10483565246ef0841c738fc086c91373821c7ce5 (diff)
downloadbcm5719-llvm-a5958869f6bcd57e8691e6c4fb4086a96c17e419.tar.gz
bcm5719-llvm-a5958869f6bcd57e8691e6c4fb4086a96c17e419.zip
TrackConstraintBRVisitor and ConditionBRVisitor can emit similar
path notes for cases where a value may be assumed to be null, etc. Instead of having redundant diagnostics, do a pass over the generated PathDiagnostic pieces and remove notes from TrackConstraintBRVisitor that are already covered by ConditionBRVisitor, whose notes tend to be better. Fixes <rdar://problem/12252783> llvm-svn: 166728
Diffstat (limited to 'clang/test/Analysis/method-call-path-notes.cpp')
-rw-r--r--clang/test/Analysis/method-call-path-notes.cpp86
1 files changed, 14 insertions, 72 deletions
diff --git a/clang/test/Analysis/method-call-path-notes.cpp b/clang/test/Analysis/method-call-path-notes.cpp
index 75996306569..a41a7864aa0 100644
--- a/clang/test/Analysis/method-call-path-notes.cpp
+++ b/clang/test/Analysis/method-call-path-notes.cpp
@@ -26,7 +26,7 @@ void test_ic_set_to_null() {
}
void test_ic_null(TestInstanceCall *p) {
- if (!p) // expected-note {{Assuming pointer value is null}} expected-note {{Assuming 'p' is null}} expected-note {{Taking true branch}}
+ if (!p) // expected-note {{Assuming 'p' is null}} expected-note {{Taking true branch}}
p->foo(); // expected-warning {{Called C++ object pointer is null}} expected-note{{Called C++ object pointer is null}}
}
@@ -38,7 +38,7 @@ void test_ic_member_ptr() {
}
void test_cast(const TestInstanceCall *p) {
- if (!p) // expected-note {{Assuming pointer value is null}} expected-note {{Assuming 'p' is null}} expected-note {{Taking true branch}}
+ if (!p) // expected-note {{Assuming 'p' is null}} expected-note {{Taking true branch}}
const_cast<TestInstanceCall *>(p)->foo(); // expected-warning {{Called C++ object pointer is null}} expected-note {{Called C++ object pointer is null}}
}
@@ -74,7 +74,7 @@ void test_cast(const TestInstanceCall *p) {
// CHECK-NEXT: <key>extended_message</key>
// CHECK-NEXT: <string>Variable &apos;p&apos; declared without an initial value</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Variable &apos;p&apos; declared without an initial value</string>
+// CHECK-NEXT: <string>Variable &apos;p&apos; declared without an initial value</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -137,7 +137,7 @@ void test_cast(const TestInstanceCall *p) {
// CHECK-NEXT: <key>extended_message</key>
// CHECK-NEXT: <string>Called C++ object pointer is uninitialized</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Called C++ object pointer is uninitialized</string>
+// CHECK-NEXT: <string>Called C++ object pointer is uninitialized</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>description</key><string>Called C++ object pointer is uninitialized</string>
@@ -183,7 +183,7 @@ void test_cast(const TestInstanceCall *p) {
// CHECK-NEXT: <key>extended_message</key>
// CHECK-NEXT: <string>Variable &apos;p&apos; initialized to a null pointer value</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Variable &apos;p&apos; initialized to a null pointer value</string>
+// CHECK-NEXT: <string>Variable &apos;p&apos; initialized to a null pointer value</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -246,7 +246,7 @@ void test_cast(const TestInstanceCall *p) {
// CHECK-NEXT: <key>extended_message</key>
// CHECK-NEXT: <string>Called C++ object pointer is null</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Called C++ object pointer is null</string>
+// CHECK-NEXT: <string>Called C++ object pointer is null</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>description</key><string>Called C++ object pointer is null</string>
@@ -326,7 +326,7 @@ void test_cast(const TestInstanceCall *p) {
// CHECK-NEXT: <key>extended_message</key>
// CHECK-NEXT: <string>Null pointer value stored to &apos;p&apos;</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Null pointer value stored to &apos;p&apos;</string>
+// CHECK-NEXT: <string>Null pointer value stored to &apos;p&apos;</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -389,7 +389,7 @@ void test_cast(const TestInstanceCall *p) {
// CHECK-NEXT: <key>extended_message</key>
// CHECK-NEXT: <string>Called C++ object pointer is null</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Called C++ object pointer is null</string>
+// CHECK-NEXT: <string>Called C++ object pointer is null</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>description</key><string>Called C++ object pointer is null</string>
@@ -469,36 +469,7 @@ void test_cast(const TestInstanceCall *p) {
// CHECK-NEXT: <key>extended_message</key>
// CHECK-NEXT: <string>Assuming &apos;p&apos; is null</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Assuming &apos;p&apos; is null</string>
-// CHECK-NEXT: </dict>
-// CHECK-NEXT: <dict>
-// CHECK-NEXT: <key>kind</key><string>event</string>
-// CHECK-NEXT: <key>location</key>
-// CHECK-NEXT: <dict>
-// CHECK-NEXT: <key>line</key><integer>29</integer>
-// CHECK-NEXT: <key>col</key><integer>7</integer>
-// CHECK-NEXT: <key>file</key><integer>0</integer>
-// CHECK-NEXT: </dict>
-// CHECK-NEXT: <key>ranges</key>
-// CHECK-NEXT: <array>
-// CHECK-NEXT: <array>
-// CHECK-NEXT: <dict>
-// CHECK-NEXT: <key>line</key><integer>29</integer>
-// CHECK-NEXT: <key>col</key><integer>7</integer>
-// CHECK-NEXT: <key>file</key><integer>0</integer>
-// CHECK-NEXT: </dict>
-// CHECK-NEXT: <dict>
-// CHECK-NEXT: <key>line</key><integer>29</integer>
-// CHECK-NEXT: <key>col</key><integer>8</integer>
-// CHECK-NEXT: <key>file</key><integer>0</integer>
-// CHECK-NEXT: </dict>
-// CHECK-NEXT: </array>
-// CHECK-NEXT: </array>
-// CHECK-NEXT: <key>depth</key><integer>0</integer>
-// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Assuming pointer value is null</string>
-// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Assuming pointer value is null</string>
+// CHECK-NEXT: <string>Assuming &apos;p&apos; is null</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -561,7 +532,7 @@ void test_cast(const TestInstanceCall *p) {
// CHECK-NEXT: <key>extended_message</key>
// CHECK-NEXT: <string>Called C++ object pointer is null</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Called C++ object pointer is null</string>
+// CHECK-NEXT: <string>Called C++ object pointer is null</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>description</key><string>Called C++ object pointer is null</string>
@@ -607,7 +578,7 @@ void test_cast(const TestInstanceCall *p) {
// CHECK-NEXT: <key>extended_message</key>
// CHECK-NEXT: <string>Variable &apos;p&apos; initialized to a null pointer value</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Variable &apos;p&apos; initialized to a null pointer value</string>
+// CHECK-NEXT: <string>Variable &apos;p&apos; initialized to a null pointer value</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -670,7 +641,7 @@ void test_cast(const TestInstanceCall *p) {
// CHECK-NEXT: <key>extended_message</key>
// CHECK-NEXT: <string>Called C++ object pointer is null</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Called C++ object pointer is null</string>
+// CHECK-NEXT: <string>Called C++ object pointer is null</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>description</key><string>Called C++ object pointer is null</string>
@@ -750,36 +721,7 @@ void test_cast(const TestInstanceCall *p) {
// CHECK-NEXT: <key>extended_message</key>
// CHECK-NEXT: <string>Assuming &apos;p&apos; is null</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Assuming &apos;p&apos; is null</string>
-// CHECK-NEXT: </dict>
-// CHECK-NEXT: <dict>
-// CHECK-NEXT: <key>kind</key><string>event</string>
-// CHECK-NEXT: <key>location</key>
-// CHECK-NEXT: <dict>
-// CHECK-NEXT: <key>line</key><integer>41</integer>
-// CHECK-NEXT: <key>col</key><integer>7</integer>
-// CHECK-NEXT: <key>file</key><integer>0</integer>
-// CHECK-NEXT: </dict>
-// CHECK-NEXT: <key>ranges</key>
-// CHECK-NEXT: <array>
-// CHECK-NEXT: <array>
-// CHECK-NEXT: <dict>
-// CHECK-NEXT: <key>line</key><integer>41</integer>
-// CHECK-NEXT: <key>col</key><integer>7</integer>
-// CHECK-NEXT: <key>file</key><integer>0</integer>
-// CHECK-NEXT: </dict>
-// CHECK-NEXT: <dict>
-// CHECK-NEXT: <key>line</key><integer>41</integer>
-// CHECK-NEXT: <key>col</key><integer>8</integer>
-// CHECK-NEXT: <key>file</key><integer>0</integer>
-// CHECK-NEXT: </dict>
-// CHECK-NEXT: </array>
-// CHECK-NEXT: </array>
-// CHECK-NEXT: <key>depth</key><integer>0</integer>
-// CHECK-NEXT: <key>extended_message</key>
-// CHECK-NEXT: <string>Assuming pointer value is null</string>
-// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Assuming pointer value is null</string>
+// CHECK-NEXT: <string>Assuming &apos;p&apos; is null</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>control</string>
@@ -842,7 +784,7 @@ void test_cast(const TestInstanceCall *p) {
// CHECK-NEXT: <key>extended_message</key>
// CHECK-NEXT: <string>Called C++ object pointer is null</string>
// CHECK-NEXT: <key>message</key>
-// CHECK-NEXT: <string>Called C++ object pointer is null</string>
+// CHECK-NEXT: <string>Called C++ object pointer is null</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>description</key><string>Called C++ object pointer is null</string>
OpenPOWER on IntegriCloud