[PATCH] D27717: [analyzer] Suppress a leak false positive in Qt's QObject::connectImpl()
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 16 04:32:22 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL289939: [analyzer] Add another exception for Qt in MallocChecker (authored by dergachev).
Changed prior to commit:
https://reviews.llvm.org/D27717?vs=81239&id=81738#toc
Repository:
rL LLVM
https://reviews.llvm.org/D27717
Files:
cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
cfe/trunk/test/Analysis/Inputs/qt-simulator.h
cfe/trunk/test/Analysis/qt_malloc.cpp
Index: cfe/trunk/test/Analysis/qt_malloc.cpp
===================================================================
--- cfe/trunk/test/Analysis/qt_malloc.cpp
+++ cfe/trunk/test/Analysis/qt_malloc.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,cplusplus -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -std=c++11 -analyze -analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,cplusplus -analyzer-store=region -verify %s
// expected-no-diagnostics
#include "Inputs/qt-simulator.h"
@@ -13,3 +13,9 @@
QEvent *e4 = new QEvent(QEvent::None);
QApplication::postEvent(obj, e4);
}
+
+void connect(QObject *obj) {
+ obj->connectImpl(nullptr, nullptr, nullptr, nullptr,
+ new QtPrivate::QSlotObjectBase(), (Qt::ConnectionType)0,
+ nullptr, nullptr);
+}
Index: cfe/trunk/test/Analysis/Inputs/qt-simulator.h
===================================================================
--- cfe/trunk/test/Analysis/Inputs/qt-simulator.h
+++ cfe/trunk/test/Analysis/Inputs/qt-simulator.h
@@ -1,6 +1,23 @@
#pragma clang system_header
+namespace QtPrivate {
+struct QSlotObjectBase {};
+}
+
+namespace Qt {
+enum ConnectionType {};
+}
+
+struct QMetaObject {
+ struct Connection {};
+};
+
struct QObject {
+ static QMetaObject::Connection connectImpl(const QObject *, void **,
+ const QObject *, void **,
+ QtPrivate::QSlotObjectBase *,
+ Qt::ConnectionType,
+ const int *, const QMetaObject *);
};
struct QEvent {
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2579,6 +2579,11 @@
return true;
}
+ if (FName == "connectImpl" &&
+ FD->getQualifiedNameAsString() == "QObject::connectImpl") {
+ return true;
+ }
+
// Handle cases where we know a buffer's /address/ can escape.
// Note that the above checks handle some special cases where we know that
// even though the address escapes, it's still our responsibility to free the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27717.81738.patch
Type: text/x-patch
Size: 2394 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161216/6e350ffb/attachment.bin>
More information about the cfe-commits
mailing list