Consume checker names from clang static analyzer.

Summary: This patch depends on patches D2556 and D2557.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits, jordan_rose, krememek

Differential Revision: http://llvm-reviews.chandlerc.com/D2620

llvm-svn: 201221
This commit is contained in:
Alexander Kornienko 2014-02-12 09:52:07 +00:00
parent d90ec5717a
commit d1afc70795
2 changed files with 13 additions and 3 deletions

View File

@ -71,7 +71,8 @@ public:
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());

View File

@ -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]
}