[analyzer]Revert part of r161511; suppresses leak false positives in C++
This is a "quick fix".
The underlining issue is that when a const pointer to a struct is passed
into a function, we do not invalidate the pointer fields. This results
in false positives that are common in C++ (since copy constructors are
prevalent). (Silences two llvm false positives.)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174468 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/malloc.cpp b/test/Analysis/malloc.cpp
index 58b94ea..a7c3652 100644
--- a/test/Analysis/malloc.cpp
+++ b/test/Analysis/malloc.cpp
@@ -60,3 +60,10 @@
}
}
+struct X { void *a; };
+
+struct X get() {
+ struct X result;
+ result.a = malloc(4);
+ return result; // no-warning
+}