| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
While collections containing nil elements can still be iterated over in an
Objective-C for-in loop, the most common Cocoa collections -- NSArray,
NSDictionary, and NSSet -- cannot contain nil elements. This checker adds
that assumption to the analyzer state.
This was the cause of some minor false positives concerning CFRelease calls
on objects in an NSArray.
llvm-svn: 158319
|
| |
|
|
|
|
|
|
|
| |
This has a small hit in the case where only one class is interesting
(NilArgChecker) but is a big improvement when looking for one of several
interesting classes (VariadicMethodTypeChecker), in which the most common
case is that there is no match.
llvm-svn: 158318
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
to addition.
We should not to warn in case the malloc size argument is an
addition containing 'sizeof' operator - it is common to use the pattern
to pack values of different sizes into a buffer.
Ex:
uint8_t *buffer = (uint8_t*)malloc(dataSize + sizeof(length));
llvm-svn: 158219
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Add a concept of symbolic memory region belonging to heap memory space.
When comparing symbolic regions allocated on the heap, assume that they
do not alias.
Use symbolic heap region to suppress a common false positive pattern in
the malloc checker, in code that relies on malloc not returning the
memory aliased to other malloc allocations, stack.
llvm-svn: 158136
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
value_type
In addition, I've made the pointer and reference typedef 'void' rather than T*
just so they can't get misused. I would've omitted them entirely but
std::distance likes them to be there even if it doesn't use them.
This rolls back r155808 and r155869.
Review by Doug Gregor incorporating feedback from Chandler Carruth.
llvm-svn: 158104
|
| |
|
|
|
|
| |
-Wunused-private-field.
llvm-svn: 158086
|
| |
|
|
|
|
|
|
| |
to see more of the path
to discover how a value was used uninitialized.
llvm-svn: 158048
|
| |
|
|
| |
llvm-svn: 157886
|
| |
|
|
| |
llvm-svn: 157851
|
| |
|
|
| |
llvm-svn: 157772
|
| |
|
|
|
|
|
|
|
| |
we have significantly
improved the pruning heuristics. The current heuristics are pretty good, but they make diagnostics
for uninitialized variables warnings particularly useless in some cases.
llvm-svn: 157734
|
| |
|
|
| |
llvm-svn: 157531
|
| |
|
|
| |
llvm-svn: 157402
|
| |
|
|
| |
llvm-svn: 157081
|
| |
|
|
|
|
| |
allocating functions.
llvm-svn: 157037
|
| |
|
|
|
|
|
|
|
|
| |
The new debug.ExprInspection checker looks for calls to clang_analyzer_eval,
and emits a warning of TRUE, FALSE, or UNKNOWN (or UNDEFINED) based on the
constrained value of its (boolean) argument. It does not modify the analysis
state though the conditions tested can result in branches (e.g. through the
use of short-circuit operators).
llvm-svn: 156919
|
| |
|
|
|
|
|
| |
We can no longer rely on children iterator to visit all the AST
tree children of an expression (OpaqueValueExpr has no children).
llvm-svn: 156870
|
| |
|
|
|
|
|
|
|
|
| |
We check the address of the last element accessed, but with 0 calculating that
address results in element -1. This patch bails out early (and avoids a bunch
of other work at that).
Fixes PR12807.
llvm-svn: 156769
|
| |
|
|
| |
llvm-svn: 156699
|
| |
|
|
|
|
|
|
|
|
| |
We report a leak at a point a leaked variable is no longer accessible.
The statement that happens to be at that point is not relevant to the
leak diagnostic and, thus, should not be highlighted.
radar://11178519
llvm-svn: 156530
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
don't reason about.
Self is just like a local variable in init methods, so it can be
assigned anything like result of static functions, other methods ... So
to suppress false positives that result in such cases, stop tracking the
checker-specific state after self is being assigned to (unless the
value is't being assigned to is either self or conforms to our rules).
This change does not invalidate any existing regression tests.
llvm-svn: 156420
|
| |
|
|
|
|
| |
references (thus extending their lifetime).
llvm-svn: 156346
|
| |
|
|
| |
llvm-svn: 156341
|
| |
|
|
|
|
|
| |
As per Jordy's and Ted's comment, use the default StopTracking summary
instead of adding all arguments to ScratchArs.
llvm-svn: 156310
|
| |
|
|
|
|
| |
Fixes radar://10973977.
llvm-svn: 156215
|
| |
|
|
|
|
|
| |
(Since we don't have a generic pointer escape callback, modify
ExprEngineCallAndReturn as well as the malloc checker.)
llvm-svn: 156134
|
| |
|
|
|
|
|
|
|
|
| |
specifically checks for equality to null.
Enforcing this general practice, which keeps the analyzer less
noisy, in the CString Checker. This change suppresses "Assigned value is
garbage or undefined" warning in the added test case.
llvm-svn: 156085
|
| |
|
|
|
|
| |
warning.
llvm-svn: 155966
|
| |
|
|
| |
llvm-svn: 155963
|
| |
|
|
|
|
| |
retained objects. I know there is an SDK enhancement request for this to have the cf_returns_retained annotation, so this is just a stop gap.
llvm-svn: 155887
|
| |
|
|
|
|
|
|
| |
a sizeof() type is compatible with a pointed type.
Fixes <rdar://problem/11292586>.
llvm-svn: 155864
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
filter_decl_iterator had a weird mismatch where both op* and op-> returned T*
making it difficult to generalize this filtering behavior into a reusable
library of any kind.
This change errs on the side of value, making op-> return T* and op* return
T&.
(reviewed by Richard Smith)
llvm-svn: 155808
|
| |
|
|
|
|
| |
pthread_setspecific and it should just give up when it sees it. Fixes <rdar://problem/11282706>.
llvm-svn: 155613
|
| |
|
|
|
|
| |
Along with it, fix a couple of other corner cases and add more tests.
llvm-svn: 154866
|
| |
|
|
|
|
|
|
|
|
| |
(Applied changes to CStringAPI, Malloc, and Taint.)
This might almost never happen, but we should not crash even if it does.
This fixes a crash on the internal analyzer buildbot, where postgresql's
configure was redefining memmove (radar://11219852).
llvm-svn: 154451
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
when we generate a new ExplodedNode
we use the same Expr* as the one being currently visited. This is preparation for transitioning to having
ProgramPoints refer to CFGStmts.
This required a bit of trickery. We wish to keep the old Expr* bindings in the Environment intact,
as plenty of logic relies on it and there is no reason to change it, but we sometimes want the Stmt* for
the ProgramPoint to be different than the Expr* being used for bindings. This requires adding an extra
argument for some functions (e.g., evalLocation). This looks a bit strange for some clients, but
it will look a lot cleaner when were start using CFGStmt* in the appropriate places.
As some fallout, the diagnostics arrows are a bit difference, since some of the node locations have changed.
I have audited these, and they look reasonable.
llvm-svn: 154214
|
| |
|
|
|
|
|
|
| |
valid ObjC objects.
Patch by Sean McBride!
llvm-svn: 154194
|
| |
|
|
|
|
|
|
|
|
| |
change,
consolidate some commonly used category strings into global references (more of this can be done, I just did a few).
Fixes <rdar://problem/11191537>.
llvm-svn: 154121
|
| |
|
|
|
|
| |
might not be a symbolic value.
llvm-svn: 154083
|
| |
|
|
|
|
|
|
| |
the DeadStoresChecker.
Fixes <rdar://problem/11185138>.
llvm-svn: 154040
|
| |
|
|
|
|
|
|
| |
analyzer issue occurred in the plist output.
Fixes <rdar://problem/11004527>
llvm-svn: 154030
|
| |
|
|
|
|
| |
layer of inderection with std::list
llvm-svn: 153847
|
| |
|
|
|
|
|
|
| |
Fixes a false positive (radar://11152419). The current solution of
adding the info into 3 places is quite ugly. Pending a generic pointer
escapes callback.
llvm-svn: 153731
|
| |
|
|
|
|
|
|
| |
the root function.
(This is a bit cleaner then using the StackFrame.)
llvm-svn: 153580
|
| |
|
|
|
|
|
|
|
| |
Report root function name with exhausted block diagnostic.
Also, use stack frames, not just any location context when checking if
the basic block is in the same context.
llvm-svn: 153532
|
| |
|
|
|
|
|
|
|
|
|
|
| |
assigned to a struct. This is fallout from inlining results, which expose
far more patterns where people stuff CF objects into structs and pass them
around (and we can reason about it). The problem is that we don't have
a general way to detect when values have escaped, so as an intermediate step
we need to eagerly prune out such tracking.
Fixes <rdar://problem/11104566>.
llvm-svn: 153489
|
| |
|
|
| |
llvm-svn: 153453
|
| |
|
|
|
|
| |
we get the right realloc()!
llvm-svn: 153370
|
| |
|
|
|
|
|
|
|
|
| |
the report configuration while walking the path.
This required adding a change count token to BugReport, but also allowed us to ditch ImmutableList as the BugReporterVisitor data type.
Also, remove the hack from MallocChecker, now that visitors appear in the opposite order. This is not exactly a fix, but the common case -- custom diagnostics after generic ones -- is now the default behavior.
llvm-svn: 153369
|
| |
|
|
|
|
| |
to reset diagnostic generation.
llvm-svn: 153368
|