summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/NewDelete-atomics.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2018-03-21 00:49:47 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2018-03-21 00:49:47 +0000
commitff1fc21e8a6974d2e3469bf37362bf61a408fced (patch)
treec8c6775b80abacb1332d4e2a36ddf74e6e896790 /clang/test/Analysis/NewDelete-atomics.cpp
parent1963e4b9c5ae0a32dcca77567cbe3e5656e64036 (diff)
downloadbcm5719-llvm-ff1fc21e8a6974d2e3469bf37362bf61a408fced.tar.gz
bcm5719-llvm-ff1fc21e8a6974d2e3469bf37362bf61a408fced.zip
[analyzer] Suppress more MallocChecker positives in smart pointer destructors.
r326249 wasn't quite enough because we often run out of inlining stack depth limit and for that reason fail to see the atomics we're looking for. Add a more straightforward false positive suppression that is based on the name of the class. I.e. if we're releasing a pointer in a destructor of a "something shared/intrusive/reference/counting something ptr/pointer something", then any use-after-free or double-free that occurs later would likely be a false positive. rdar://problem/38013606 Differential Revision: https://reviews.llvm.org/D44281 llvm-svn: 328066
Diffstat (limited to 'clang/test/Analysis/NewDelete-atomics.cpp')
-rw-r--r--clang/test/Analysis/NewDelete-atomics.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/test/Analysis/NewDelete-atomics.cpp b/clang/test/Analysis/NewDelete-atomics.cpp
index 275cf143899..54fce17ea7b 100644
--- a/clang/test/Analysis/NewDelete-atomics.cpp
+++ b/clang/test/Analysis/NewDelete-atomics.cpp
@@ -2,6 +2,10 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDeleteLeaks -DLEAKS -std=c++11 -verify %s
// RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDelete -std=c++11 -DTEST_INLINABLE_ALLOCATORS -verify %s
// RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDeleteLeaks -DLEAKS -std=c++11 -DTEST_INLINABLE_ALLOCATORS -verify %s
+// RUN: %clang_analyze_cc1 -analyzer-inline-max-stack-depth 2 -analyzer-config ipa-always-inline-size=2 -analyzer-checker=core,cplusplus.NewDelete -std=c++11 -verify %s
+// RUN: %clang_analyze_cc1 -analyzer-inline-max-stack-depth 2 -analyzer-config ipa-always-inline-size=2 -analyzer-checker=core,cplusplus.NewDeleteLeaks -DLEAKS -std=c++11 -verify %s
+// RUN: %clang_analyze_cc1 -analyzer-inline-max-stack-depth 2 -analyzer-config ipa-always-inline-size=2 -analyzer-checker=core,cplusplus.NewDelete -std=c++11 -DTEST_INLINABLE_ALLOCATORS -verify %s
+// RUN: %clang_analyze_cc1 -analyzer-inline-max-stack-depth 2 -analyzer-config ipa-always-inline-size=2 -analyzer-checker=core,cplusplus.NewDeleteLeaks -DLEAKS -std=c++11 -DTEST_INLINABLE_ALLOCATORS -verify %s
// expected-no-diagnostics
@@ -51,7 +55,7 @@ public:
delete Ptr;
}
- Obj *getPtr() const { return Ptr; }
+ Obj *getPtr() const { return Ptr; } // no-warning
};
void testDestroyLocalRefPtr() {
OpenPOWER on IntegriCloud