[PATCH] D71321: [analyzer] CStringChecker: Warning text fixes.

2019-12-11 Thread Artem Dergachev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG134faae04259: [analyzer] CStringChecker: Improve warning 
messages. (authored by dergachev.a).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71321/new/

https://reviews.llvm.org/D71321

Files:
  clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
  clang/test/Analysis/bsd-string.c
  clang/test/Analysis/bstring.c
  clang/test/Analysis/cstring-ranges.c
  clang/test/Analysis/null-deref-path-notes.c
  clang/test/Analysis/null-deref-ps-region.c
  clang/test/Analysis/string.c

Index: clang/test/Analysis/string.c
===
--- clang/test/Analysis/string.c
+++ clang/test/Analysis/string.c
@@ -97,7 +97,7 @@
 }
 
 size_t strlen_null() {
-  return strlen(0); // expected-warning{{Null pointer argument in call to string length function}}
+  return strlen(0); // expected-warning{{Null pointer passed as 1st argument to string length function}}
 }
 
 size_t strlen_fn() {
@@ -251,7 +251,7 @@
 }
 
 size_t strnlen_null() {
-  return strnlen(0, 3); // expected-warning{{Null pointer argument in call to string length function}}
+  return strnlen(0, 3); // expected-warning{{Null pointer passed as 1st argument to string length function}}
 }
 
 size_t strnlen_fn() {
@@ -322,11 +322,11 @@
 
 
 void strcpy_null_dst(char *x) {
-  strcpy(NULL, x); // expected-warning{{Null pointer argument in call to string copy function}}
+  strcpy(NULL, x); // expected-warning{{Null pointer passed as 1st argument to string copy function}}
 }
 
 void strcpy_null_src(char *x) {
-  strcpy(x, NULL); // expected-warning{{Null pointer argument in call to string copy function}}
+  strcpy(x, NULL); // expected-warning{{Null pointer passed as 2nd argument to string copy function}}
 }
 
 void strcpy_fn(char *x) {
@@ -424,15 +424,15 @@
 
 
 void strcat_null_dst(char *x) {
-  strcat(NULL, x); // expected-warning{{Null pointer argument in call to string copy function}}
+  strcat(NULL, x); // expected-warning{{Null pointer passed as 1st argument to string concatenation function}}
 }
 
 void strcat_null_src(char *x) {
-  strcat(x, NULL); // expected-warning{{Null pointer argument in call to string copy function}}
+  strcat(x, NULL); // expected-warning{{Null pointer passed as 2nd argument to string concatenation function}}
 }
 
 void strcat_fn(char *x) {
-  strcat(x, (char*)_fn); // expected-warning{{Argument to string copy function is the address of the function 'strcat_fn', which is not a null-terminated string}}
+  strcat(x, (char*)_fn); // expected-warning{{Argument to string concatenation function is the address of the function 'strcat_fn', which is not a null-terminated string}}
 }
 
 void strcat_effects(char *y) {
@@ -523,11 +523,11 @@
 
 
 void strncpy_null_dst(char *x) {
-  strncpy(NULL, x, 5); // expected-warning{{Null pointer argument in call to string copy function}}
+  strncpy(NULL, x, 5); // expected-warning{{Null pointer passed as 1st argument to string copy function}}
 }
 
 void strncpy_null_src(char *x) {
-  strncpy(x, NULL, 5); // expected-warning{{Null pointer argument in call to string copy function}}
+  strncpy(x, NULL, 5); // expected-warning{{Null pointer passed as 2nd argument to string copy function}}
 }
 
 void strncpy_fn(char *x) {
@@ -631,15 +631,15 @@
 
 
 void strncat_null_dst(char *x) {
-  strncat(NULL, x, 4); // expected-warning{{Null pointer argument in call to string copy function}}
+  strncat(NULL, x, 4); // expected-warning{{Null pointer passed as 1st argument to string concatenation function}}
 }
 
 void strncat_null_src(char *x) {
-  strncat(x, NULL, 4); // expected-warning{{Null pointer argument in call to string copy function}}
+  strncat(x, NULL, 4); // expected-warning{{Null pointer passed as 2nd argument to string concatenation function}}
 }
 
 void strncat_fn(char *x) {
-  strncat(x, (char*)_fn, 4); // expected-warning{{Argument to string copy function is the address of the function 'strncat_fn', which is not a null-terminated string}}
+  strncat(x, (char*)_fn, 4); // expected-warning{{Argument to string concatenation function is the address of the function 'strncat_fn', which is not a null-terminated string}}
 }
 
 void strncat_effects(char *y) {
@@ -812,13 +812,13 @@
 void strcmp_null_0() {
   char *x = NULL;
   char *y = "123";
-  strcmp(x, y); // expected-warning{{Null pointer argument in call to string comparison function}}
+  strcmp(x, y); // expected-warning{{Null pointer passed as 1st argument to string comparison function}}
 }
 
 void strcmp_null_1() {
   char *x = "123";
   char *y = NULL;
-  strcmp(x, y); // expected-warning{{Null pointer argument in call to string comparison function}}
+  strcmp(x, y); // expected-warning{{Null pointer passed as 2nd argument to string comparison function}}
 }
 
 void strcmp_diff_length_0() {
@@ -921,13 +921,13 @@
 void strncmp_null_0() {
   char *x = NULL;
   char *y = "123";
-  

[PATCH] D71321: [analyzer] CStringChecker: Warning text fixes.

2019-12-11 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun accepted this revision.
xazax.hun added a comment.

Cool! :)


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71321/new/

https://reviews.llvm.org/D71321



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71321: [analyzer] CStringChecker: Warning text fixes.

2019-12-10 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso accepted this revision.
Charusso added a comment.
This revision is now accepted and ready to land.

Cool, thanks!


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71321/new/

https://reviews.llvm.org/D71321



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71321: [analyzer] CStringChecker: Warning text fixes.

2019-12-10 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ created this revision.
NoQ added reviewers: dcoughlin, xazax.hun, a_sidorin, rnkovacs, Szelethus, 
baloghadamsoftware, Charusso.
Herald added subscribers: cfe-commits, dkrupp, donat.nagy, mikhail.ramalho, 
a.sidorin, szepet.
Herald added a project: clang.

Fixes the problem mentioned in D66333#1726488 
. Additionally refers to `strcat` as 
"memory concatenation function" as opposed to "memory copy functions".

TODO: Add a flag to `VerifyDiagnosticConsumer` to match full messages by 
default.


Repository:
  rC Clang

https://reviews.llvm.org/D71321

Files:
  clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
  clang/test/Analysis/bsd-string.c
  clang/test/Analysis/bstring.c
  clang/test/Analysis/cstring-ranges.c
  clang/test/Analysis/null-deref-path-notes.c
  clang/test/Analysis/null-deref-ps-region.c
  clang/test/Analysis/string.c

Index: clang/test/Analysis/string.c
===
--- clang/test/Analysis/string.c
+++ clang/test/Analysis/string.c
@@ -97,7 +97,7 @@
 }
 
 size_t strlen_null() {
-  return strlen(0); // expected-warning{{Null pointer argument in call to string length function}}
+  return strlen(0); // expected-warning{{Null pointer passed as 1st argument to string length function}}
 }
 
 size_t strlen_fn() {
@@ -251,7 +251,7 @@
 }
 
 size_t strnlen_null() {
-  return strnlen(0, 3); // expected-warning{{Null pointer argument in call to string length function}}
+  return strnlen(0, 3); // expected-warning{{Null pointer passed as 1st argument to string length function}}
 }
 
 size_t strnlen_fn() {
@@ -322,11 +322,11 @@
 
 
 void strcpy_null_dst(char *x) {
-  strcpy(NULL, x); // expected-warning{{Null pointer argument in call to string copy function}}
+  strcpy(NULL, x); // expected-warning{{Null pointer passed as 1st argument to string copy function}}
 }
 
 void strcpy_null_src(char *x) {
-  strcpy(x, NULL); // expected-warning{{Null pointer argument in call to string copy function}}
+  strcpy(x, NULL); // expected-warning{{Null pointer passed as 2nd argument to string copy function}}
 }
 
 void strcpy_fn(char *x) {
@@ -424,15 +424,15 @@
 
 
 void strcat_null_dst(char *x) {
-  strcat(NULL, x); // expected-warning{{Null pointer argument in call to string copy function}}
+  strcat(NULL, x); // expected-warning{{Null pointer passed as 1st argument to string concatenation function}}
 }
 
 void strcat_null_src(char *x) {
-  strcat(x, NULL); // expected-warning{{Null pointer argument in call to string copy function}}
+  strcat(x, NULL); // expected-warning{{Null pointer passed as 2nd argument to string concatenation function}}
 }
 
 void strcat_fn(char *x) {
-  strcat(x, (char*)_fn); // expected-warning{{Argument to string copy function is the address of the function 'strcat_fn', which is not a null-terminated string}}
+  strcat(x, (char*)_fn); // expected-warning{{Argument to string concatenation function is the address of the function 'strcat_fn', which is not a null-terminated string}}
 }
 
 void strcat_effects(char *y) {
@@ -523,11 +523,11 @@
 
 
 void strncpy_null_dst(char *x) {
-  strncpy(NULL, x, 5); // expected-warning{{Null pointer argument in call to string copy function}}
+  strncpy(NULL, x, 5); // expected-warning{{Null pointer passed as 1st argument to string copy function}}
 }
 
 void strncpy_null_src(char *x) {
-  strncpy(x, NULL, 5); // expected-warning{{Null pointer argument in call to string copy function}}
+  strncpy(x, NULL, 5); // expected-warning{{Null pointer passed as 2nd argument to string copy function}}
 }
 
 void strncpy_fn(char *x) {
@@ -631,15 +631,15 @@
 
 
 void strncat_null_dst(char *x) {
-  strncat(NULL, x, 4); // expected-warning{{Null pointer argument in call to string copy function}}
+  strncat(NULL, x, 4); // expected-warning{{Null pointer passed as 1st argument to string concatenation function}}
 }
 
 void strncat_null_src(char *x) {
-  strncat(x, NULL, 4); // expected-warning{{Null pointer argument in call to string copy function}}
+  strncat(x, NULL, 4); // expected-warning{{Null pointer passed as 2nd argument to string concatenation function}}
 }
 
 void strncat_fn(char *x) {
-  strncat(x, (char*)_fn, 4); // expected-warning{{Argument to string copy function is the address of the function 'strncat_fn', which is not a null-terminated string}}
+  strncat(x, (char*)_fn, 4); // expected-warning{{Argument to string concatenation function is the address of the function 'strncat_fn', which is not a null-terminated string}}
 }
 
 void strncat_effects(char *y) {
@@ -812,13 +812,13 @@
 void strcmp_null_0() {
   char *x = NULL;
   char *y = "123";
-  strcmp(x, y); // expected-warning{{Null pointer argument in call to string comparison function}}
+  strcmp(x, y); // expected-warning{{Null pointer passed as 1st argument to string comparison function}}
 }
 
 void strcmp_null_1() {
   char *x = "123";
   char *y = NULL;
-  strcmp(x, y); // expected-warning{{Null pointer