forked from OSchip/llvm-project
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:
parent
d90ec5717a
commit
d1afc70795
|
@ -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());
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue