[clang-tools-extra] r201221 - Consume checker names from clang static analyzer.
Alexander Kornienko
alexfh at google.com
Wed Feb 12 01:52:07 PST 2014
Author: alexfh
Date: Wed Feb 12 03:52:07 2014
New Revision: 201221
URL: http://llvm.org/viewvc/llvm-project?rev=201221&view=rev
Log:
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
Modified:
clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
clang-tools-extra/trunk/test/clang-tidy/static-analyzer.cpp
Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=201221&r1=201220&r2=201221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Wed Feb 12 03:52:07 2014
@@ -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());
Modified: clang-tools-extra/trunk/test/clang-tidy/static-analyzer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/static-analyzer.cpp?rev=201221&r1=201220&r2=201221&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/static-analyzer.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/static-analyzer.cpp Wed Feb 12 03:52:07 2014
@@ -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]
}
More information about the cfe-commits
mailing list