summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/stackaddrleak.c
Commit message (Collapse)AuthorAgeFilesLines
* PR16074, implement warnings to catch pointer to boolean true and pointer toRichard Trieu2014-02-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | null comparison when the pointer is known to be non-null. This catches the array to pointer decay, function to pointer decay and address of variables. This does not catch address of function since this has been previously used to silence a warning. Pointer to bool conversion is under -Wbool-conversion. Pointer to null comparison is under -Wtautological-pointer-compare, a sub-group of -Wtautological-compare. void foo() { int arr[5]; int x; // warn on these conditionals if (foo); if (arr); if (&x); if (foo == null); if (arr == null); if (&x == null); if (&foo); // no warning } llvm-svn: 202216
* Re-apply "[analyzer] Model casts to bool differently from other numbers."Jordan Rose2013-05-011-2/+26
| | | | | | | | | | | | | | This doesn't appear to be the cause of the slowdown. I'll have to try a manual bisect to see if there's really anything there, or if it's just the bot itself taking on additional load. Meanwhile, this change helps with correctness. This changes an assertion and adds a test case, then re-applies r180638, which was reverted in r180714. <rdar://problem/13296133> and PR15863 llvm-svn: 180864
* Revert "[analyzer] Model casts to bool differently from other numbers."Jordan Rose2013-04-291-26/+2
| | | | | | | | | This seems to be causing quite a slowdown on our internal analyzer bot, and I'm not sure why. Needs further investigation. This reverts r180638 / 9e161ea981f22ae017b6af09d660bfc3ddf16a09. llvm-svn: 180714
* [analyzer] Model casts to bool differently from other numbers.Jordan Rose2013-04-261-2/+26
| | | | | | | | | | | | | | | | | | | Casts to bool (and _Bool) are equivalent to checks against zero, not truncations to 1 bit or 8 bits. This improved reasoning does cause a change in the behavior of the alpha BoolAssignment checker. Previously, this checker complained about statements like "bool x = y" if 'y' was known not to be 0 or 1. Now it does not, since that conversion is well-defined. It's hard to say what the "best" behavior here is: this conversion is safe, but might be better written as an explicit comparison against zero. More usefully, besides improving our model of booleans, this fixes spurious warnings when returning the address of a local variable cast to bool. <rdar://problem/13296133> llvm-svn: 180638
* [analyzer] Report leaks at the closing brace of a function body.Jordan Rose2012-11-151-6/+6
| | | | | | | | | | | | | | | | | | | | This fixes a few cases where we'd emit path notes like this: +---+ 1| v p = malloc(len); ^ |2 +---+ In general this should make path notes more consistent and more correct, especially in cases where the leak happens on the false branch of an if that jumps directly to the end of the function. There are a couple places where the leak is reported farther away from the cause; these are usually cases where there are several levels of nested braces before the end of the function. This still matches our current behavior for when there /is/ a statement after all the braces, though. llvm-svn: 168070
* [analyzer] Remove '-analyzer-check-objc-mem' flag, the nominee for best ↵Argyrios Kyrtzidis2011-02-281-1/+1
| | | | | | misnomer award. llvm-svn: 126676
* [analyzer] Migrate BuiltinFunctionChecker to CheckerV2.Argyrios Kyrtzidis2011-02-281-1/+1
| | | | llvm-svn: 126611
* Update test cases.Ted Kremenek2011-02-251-1/+1
| | | | llvm-svn: 126523
* [analyzer] Use the new registration mechanism on some of the internal ↵Argyrios Kyrtzidis2011-02-151-1/+1
| | | | | | | | | | | | | checks. These are: StackAddrLeakChecker ObjCAtSyncChecker UnixAPIChecker MacOSXAPIChecker The rest have/create implicit dependencies between checkers and need to be handled differently. llvm-svn: 125559
* Tweak stack address checker to report multiple cases where globals may ↵Ted Kremenek2010-06-171-2/+10
| | | | | | | | reference stack memory. Also refactor the diagnostics so that we print out the kind of stack memory returned. llvm-svn: 106210
* Rework StackAddrLeakChecker to find stores of stack memory addresses to ↵Ted Kremenek2010-06-171-0/+8
| | | | | | | | | | | | | | | | global variables by inspecting the Store bindings instead of iterating over all the global variables in a translation unit. By looking at the store directly, we avoid cases where we cannot directly load from the global variable, such as an array (which can result in an assertion failure) and it also catches cases where we store stack addresses to non-scalar globals. Also, but not iterating over all the globals in the translation unit, we maintain cache locality, and the complexity of the checker becomes restricted to the complexity of the analyzed function, and doesn't scale with the size of the translation unit. This fixes PR 7383. llvm-svn: 106184
* Merge StackAddrLeakChecker and ReturnStackAddressChecker.Zhongxing Xu2010-06-091-1/+1
| | | | llvm-svn: 105687
* Directly compare the StackFrameContext. This greatly simplifies logic andZhongxing Xu2010-06-091-0/+4
| | | | | | improves generality. Thanks Ted. llvm-svn: 105686
* Add a checker check if a global variable holds a local variable's address afterZhongxing Xu2010-06-081-0/+14
the function call is left where the local variable is declared. llvm-svn: 105602
OpenPOWER on IntegriCloud