[PATCH] D43074: [Analyzer] Fix a typo about `categories::MemoryError` in `MallocChecker.cpp`

2018-02-08 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC324680: [analyzer] MallocChecker: Fix one more bug category. 
(authored by dergachev, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43074?vs=133423=133521#toc

Repository:
  rC Clang

https://reviews.llvm.org/D43074

Files:
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  test/Analysis/malloc-fnptr-plist.c


Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2075,8 +2075,8 @@
 
   if (ExplodedNode *N = C.generateErrorNode()) {
 if (!BT_BadFree[*CheckKind])
-  BT_BadFree[*CheckKind].reset(
-  new BugType(CheckNames[*CheckKind], "Bad free", "Memory Error"));
+  BT_BadFree[*CheckKind].reset(new BugType(
+  CheckNames[*CheckKind], "Bad free", categories::MemoryError));
 
 SmallString<100> Buf;
 llvm::raw_svector_ostream Os(Buf);
Index: test/Analysis/malloc-fnptr-plist.c
===
--- test/Analysis/malloc-fnptr-plist.c
+++ test/Analysis/malloc-fnptr-plist.c
@@ -0,0 +1,11 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker core,unix.Malloc 
-analyzer-output=plist -o %t.plist -verify %s
+// RUN: FileCheck --input-file=%t.plist %s
+
+void free(void *);
+void (*fnptr)(int);
+void foo() {
+  free((void *)fnptr); // expected-warning{{Argument to free() is a function 
pointer}}
+}
+
+// Make sure the bug category is correct.
+// CHECK: categoryMemory error


Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2075,8 +2075,8 @@
 
   if (ExplodedNode *N = C.generateErrorNode()) {
 if (!BT_BadFree[*CheckKind])
-  BT_BadFree[*CheckKind].reset(
-  new BugType(CheckNames[*CheckKind], "Bad free", "Memory Error"));
+  BT_BadFree[*CheckKind].reset(new BugType(
+  CheckNames[*CheckKind], "Bad free", categories::MemoryError));
 
 SmallString<100> Buf;
 llvm::raw_svector_ostream Os(Buf);
Index: test/Analysis/malloc-fnptr-plist.c
===
--- test/Analysis/malloc-fnptr-plist.c
+++ test/Analysis/malloc-fnptr-plist.c
@@ -0,0 +1,11 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker core,unix.Malloc -analyzer-output=plist -o %t.plist -verify %s
+// RUN: FileCheck --input-file=%t.plist %s
+
+void free(void *);
+void (*fnptr)(int);
+void foo() {
+  free((void *)fnptr); // expected-warning{{Argument to free() is a function pointer}}
+}
+
+// Make sure the bug category is correct.
+// CHECK: categoryMemory error
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43074: [Analyzer] Fix a typo about `categories::MemoryError` in `MallocChecker.cpp`

2018-02-08 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL324680: [analyzer] MallocChecker: Fix one more bug category. 
(authored by dergachev, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D43074?vs=133423=133522#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43074

Files:
  cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  cfe/trunk/test/Analysis/malloc-fnptr-plist.c


Index: cfe/trunk/test/Analysis/malloc-fnptr-plist.c
===
--- cfe/trunk/test/Analysis/malloc-fnptr-plist.c
+++ cfe/trunk/test/Analysis/malloc-fnptr-plist.c
@@ -0,0 +1,11 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker core,unix.Malloc 
-analyzer-output=plist -o %t.plist -verify %s
+// RUN: FileCheck --input-file=%t.plist %s
+
+void free(void *);
+void (*fnptr)(int);
+void foo() {
+  free((void *)fnptr); // expected-warning{{Argument to free() is a function 
pointer}}
+}
+
+// Make sure the bug category is correct.
+// CHECK: categoryMemory error
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2075,8 +2075,8 @@
 
   if (ExplodedNode *N = C.generateErrorNode()) {
 if (!BT_BadFree[*CheckKind])
-  BT_BadFree[*CheckKind].reset(
-  new BugType(CheckNames[*CheckKind], "Bad free", "Memory Error"));
+  BT_BadFree[*CheckKind].reset(new BugType(
+  CheckNames[*CheckKind], "Bad free", categories::MemoryError));
 
 SmallString<100> Buf;
 llvm::raw_svector_ostream Os(Buf);


Index: cfe/trunk/test/Analysis/malloc-fnptr-plist.c
===
--- cfe/trunk/test/Analysis/malloc-fnptr-plist.c
+++ cfe/trunk/test/Analysis/malloc-fnptr-plist.c
@@ -0,0 +1,11 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker core,unix.Malloc -analyzer-output=plist -o %t.plist -verify %s
+// RUN: FileCheck --input-file=%t.plist %s
+
+void free(void *);
+void (*fnptr)(int);
+void foo() {
+  free((void *)fnptr); // expected-warning{{Argument to free() is a function pointer}}
+}
+
+// Make sure the bug category is correct.
+// CHECK: categoryMemory error
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2075,8 +2075,8 @@
 
   if (ExplodedNode *N = C.generateErrorNode()) {
 if (!BT_BadFree[*CheckKind])
-  BT_BadFree[*CheckKind].reset(
-  new BugType(CheckNames[*CheckKind], "Bad free", "Memory Error"));
+  BT_BadFree[*CheckKind].reset(new BugType(
+  CheckNames[*CheckKind], "Bad free", categories::MemoryError));
 
 SmallString<100> Buf;
 llvm::raw_svector_ostream Os(Buf);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43074: [Analyzer] Fix a typo about `categories::MemoryError` in `MallocChecker.cpp`

2018-02-08 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

I guess this happened due to a race with https://reviews.llvm.org/rL301913. My 
bad anyways^^


Repository:
  rC Clang

https://reviews.llvm.org/D43074



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


[PATCH] D43074: [Analyzer] Fix a typo about `categories::MemoryError` in `MallocChecker.cpp`

2018-02-08 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.

Woohoo thanks nice.


Repository:
  rC Clang

https://reviews.llvm.org/D43074



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


[PATCH] D43074: [Analyzer] Fix a typo about `categories::MemoryError` in `MallocChecker.cpp`

2018-02-08 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin accepted this revision.
a.sidorin added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rC Clang

https://reviews.llvm.org/D43074



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


[PATCH] D43074: [Analyzer] Fix a typo about `categories::MemoryError` in `MallocChecker.cpp`

2018-02-08 Thread Henry Wong via Phabricator via cfe-commits
MTC created this revision.
MTC added reviewers: NoQ, xazax.hun.
Herald added subscribers: cfe-commits, a.sidorin, rnkovacs, szepet.
Herald added a reviewer: george.karpenkov.

It should be an omission when committing https://reviews.llvm.org/rL302016.


Repository:
  rC Clang

https://reviews.llvm.org/D43074

Files:
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp


Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2075,8 +2075,8 @@
 
   if (ExplodedNode *N = C.generateErrorNode()) {
 if (!BT_BadFree[*CheckKind])
-  BT_BadFree[*CheckKind].reset(
-  new BugType(CheckNames[*CheckKind], "Bad free", "Memory Error"));
+  BT_BadFree[*CheckKind].reset(new BugType(
+  CheckNames[*CheckKind], "Bad free", categories::MemoryError));
 
 SmallString<100> Buf;
 llvm::raw_svector_ostream Os(Buf);


Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2075,8 +2075,8 @@
 
   if (ExplodedNode *N = C.generateErrorNode()) {
 if (!BT_BadFree[*CheckKind])
-  BT_BadFree[*CheckKind].reset(
-  new BugType(CheckNames[*CheckKind], "Bad free", "Memory Error"));
+  BT_BadFree[*CheckKind].reset(new BugType(
+  CheckNames[*CheckKind], "Bad free", categories::MemoryError));
 
 SmallString<100> Buf;
 llvm::raw_svector_ostream Os(Buf);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits