[PATCH] Consume checker names from clang static analyzer.
Alexander Kornienko
alexfh at google.com
Tue Feb 11 13:59:46 PST 2014
The implementation of checker names in the static analyzer is committed as r201186. Now this patch is ready for the actual review.
Hi klimek,
http://llvm-reviews.chandlerc.com/D2620
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D2620?vs=6644&id=7004#toc
Files:
clang-tidy/ClangTidy.cpp
test/clang-tidy/static-analyzer.cpp
Index: clang-tidy/ClangTidy.cpp
===================================================================
--- clang-tidy/ClangTidy.cpp
+++ clang-tidy/ClangTidy.cpp
@@ -71,7 +71,8 @@
E = Diags.end();
I != E; ++I) {
const ento::PathDiagnostic *PD = *I;
- StringRef CheckName(AnalyzerCheckNamePrefix);
+ SmallString<64> CheckName(AnalyzerCheckNamePrefix);
+ CheckName += PD->getCheckName();
addRanges(Context.diag(CheckName, PD->getLocation().asLocation(),
PD->getShortDescription()),
PD->path.back()->getRanges());
Index: test/clang-tidy/static-analyzer.cpp
===================================================================
--- test/clang-tidy/static-analyzer.cpp
+++ test/clang-tidy/static-analyzer.cpp
@@ -1,8 +1,17 @@
-// RUN: clang-tidy %s -checks='clang-analyzer-cplusplus' -- | FileCheck %s
+// RUN: clang-tidy %s -checks='clang-analyzer-' -- | FileCheck %s
+extern void *malloc(unsigned long);
+extern void free(void *);
void f() {
int *p = new int(42);
delete p;
delete p;
- // CHECK: warning: Attempt to free released memory
+ // CHECK: warning: Attempt to free released memory [clang-analyzer-cplusplus.NewDelete]
+}
+
+void g() {
+ void *q = malloc(132);
+ free(q);
+ free(q);
+ // CHECK: warning: Attempt to free released memory [clang-analyzer-unix.Malloc]
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2620.2.patch
Type: text/x-patch
Size: 1433 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140211/2b54edea/attachment.bin>
More information about the cfe-commits
mailing list