This ensures that we report the bugs associated with symbols going
out of scope in the correct function context.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151369
91177308-0d34-0410-b5e6-
96231b3b80d8
// Is this on a non-expression?
if (!isa<Expr>(S.getStmt()))
return true;
-
+
+ // Run before processing a call.
+ if (isa<CallExpr>(S.getStmt()))
+ return true;
+
// Is this an expression that is consumed by another expression? If so,
// postpone cleaning out the state.
ParentMap &PM = LC->getAnalysisDeclContext()->getParentMap();
char * x;
st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &bytes);
if (st == noErr) {
- CFStringRef userStr = CFStringCreateWithBytesNoCopy(alloc, bytes, length, 5, 0, kCFAllocatorNull); // expected-warning{{Allocated data is not released}}
- CFRelease(userStr);
+ CFStringRef userStr = CFStringCreateWithBytesNoCopy(alloc, bytes, length, 5, 0, kCFAllocatorNull);
+ CFRelease(userStr); // expected-warning{{Allocated data is not released}}
}
}
my_free1((int*)data);
}
+static char *reshape(char *in) {
+ return 0;
+}
+
+void testThatRemoveDeadBindingsRunBeforeEachCall() {
+ char *v = malloc(12);
+ v = reshape(v);
+ v = reshape(v);// expected-warning {{Memory is never released; potential memory leak}}
+}
+
// Test that we keep processing after 'return;'
void fooWithEmptyReturn(int x) {
if (x)