diff options
| author | Kristof Umann <kristof.umann@ericsson.com> | 2019-09-03 17:57:01 +0000 |
|---|---|---|
| committer | Kristof Umann <kristof.umann@ericsson.com> | 2019-09-03 17:57:01 +0000 |
| commit | 1b439659a8407f469dd932814df15244dee254d2 (patch) | |
| tree | 1452e872dd2d61291b36cf47bb498a08c0f49e18 /clang/test | |
| parent | 79b476150b2355d1445997137fc16984a0137d33 (diff) | |
| download | bcm5719-llvm-1b439659a8407f469dd932814df15244dee254d2.tar.gz bcm5719-llvm-1b439659a8407f469dd932814df15244dee254d2.zip | |
[analyzer] NonNullParamChecker and CStringChecker parameter number in checker message
There are some functions which can't be given a null pointer as parameter either
because it has a nonnull attribute or it is declared to have undefined behavior
(e.g. strcmp()). Sometimes it is hard to determine from the checker message
which parameter is null at the invocation, so now this information is included
in the message.
This commit fixes https://bugs.llvm.org/show_bug.cgi?id=39358
Reviewed By: NoQ, Szelethus, whisperity
Patch by Tibor Brunner!
Differential Revision: https://reviews.llvm.org/D66333
llvm-svn: 370798
Diffstat (limited to 'clang/test')
4 files changed, 10 insertions, 10 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 ab04dadbf47..b949e20ebbe 100644 --- a/clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist +++ b/clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist @@ -10853,12 +10853,12 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Null pointer passed as an argument to a 'nonnull' parameter</string> + <string>Null pointer passed to 1st parameter expecting 'nonnull'</string> <key>message</key> - <string>Null pointer passed as an argument to a 'nonnull' parameter</string> + <string>Null pointer passed to 1st parameter expecting 'nonnull'</string> </dict> </array> - <key>description</key><string>Null pointer passed as an argument to a 'nonnull' parameter</string> + <key>description</key><string>Null pointer passed to 1st parameter expecting 'nonnull'</string> <key>category</key><string>API</string> <key>type</key><string>Argument with 'nonnull' attribute passed null</string> <key>check_name</key><string>core.NonNullParamChecker</string> diff --git a/clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist b/clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist index ee8bf06e59f..9203e48c468 100644 --- a/clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist +++ b/clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist @@ -6141,12 +6141,12 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Null pointer passed as an argument to a 'nonnull' parameter</string> + <string>Null pointer passed to 1st parameter expecting 'nonnull'</string> <key>message</key> - <string>Null pointer passed as an argument to a 'nonnull' parameter</string> + <string>Null pointer passed to 1st parameter expecting 'nonnull'</string> </dict> </array> - <key>description</key><string>Null pointer passed as an argument to a 'nonnull' parameter</string> + <key>description</key><string>Null pointer passed to 1st parameter expecting 'nonnull'</string> <key>category</key><string>API</string> <key>type</key><string>Argument with 'nonnull' attribute passed null</string> <key>check_name</key><string>core.NonNullParamChecker</string> diff --git a/clang/test/Analysis/misc-ps-region-store.m b/clang/test/Analysis/misc-ps-region-store.m index 1ef10056312..d1011bda161 100644 --- a/clang/test/Analysis/misc-ps-region-store.m +++ b/clang/test/Analysis/misc-ps-region-store.m @@ -1205,7 +1205,7 @@ void rdar_8642434_funcA(rdar_8642434_typeB object); void rdar_8642434_funcB(struct rdar_8642434_typeA *x, struct rdar_8642434_typeA *y) { rdar_8642434_funcA(x); if (!y) - rdar_8642434_funcA(y); // expected-warning{{Null pointer passed as an argument to a 'nonnull' parameter}} + rdar_8642434_funcA(y); // expected-warning{{Null pointer passed to 1st parameter expecting 'nonnull'}} } // <rdar://problem/8848957> - Handle loads and stores from a symbolic index diff --git a/clang/test/Analysis/null-deref-ps.c b/clang/test/Analysis/null-deref-ps.c index d0e1f9f5cc3..d1c19e533de 100644 --- a/clang/test/Analysis/null-deref-ps.c +++ b/clang/test/Analysis/null-deref-ps.c @@ -88,21 +88,21 @@ int f5() { int bar(int* p, int q) __attribute__((nonnull)); int f6(int *p) { - return !p ? bar(p, 1) // expected-warning {{Null pointer passed as an argument to a 'nonnull' parameter}} + return !p ? bar(p, 1) // expected-warning {{Null pointer passed to 1st parameter expecting 'nonnull'}} : bar(p, 0); // no-warning } int bar2(int* p, int q) __attribute__((nonnull(1))); int f6b(int *p) { - return !p ? bar2(p, 1) // expected-warning {{Null pointer passed as an argument to a 'nonnull' parameter}} + return !p ? bar2(p, 1) // expected-warning {{Null pointer passed to 1st parameter expecting 'nonnull'}} : bar2(p, 0); // no-warning } int bar3(int*p, int q, int *r) __attribute__((nonnull(1,3))); int f6c(int *p, int *q) { - return !p ? bar3(q, 2, p) // expected-warning {{Null pointer passed as an argument to a 'nonnull' parameter}} + return !p ? bar3(q, 2, p) // expected-warning {{Null pointer passed to 3rd parameter expecting 'nonnull'}} : bar3(p, 2, q); // no-warning } |

