summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [analyzer] ObjCSelfInitChecker should always clean up in postCall checks.Jordan Rose2012-09-081-2/+3
| | | | | | | | | | | | | | | | | | | | ObjCSelfInitChecker stashes information in the GDM to persist it across function calls; it is stored in pre-call checks and retrieved post-call. The post-call check is supposed to clear out the stored state, but was failing to do so in cases where the call did not have a symbolic return value. This was actually causing the inappropriate cache-out from r163361. Per discussion with Anna, we should never actually cache out when assuming the receiver of an Objective-C message is non-nil, because we guarded that node generation by checking that the state has changed. Therefore, the only states that could reach this exact ExplodedNode are ones that should have merged /before/ making this assumption. r163361 has been reverted and the test case removed, since it won't actually test anything interesting now. llvm-svn: 163449
* [analyzer] Add debug output for ObjCSelfInitChecker's state.Jordan Rose2012-09-081-0/+48
| | | | | | No functionality change. llvm-svn: 163448
* [analyzer] Rename Calls.{h,cpp} to CallEvent.{h,cpp}. No functionality change.Jordan Rose2012-07-261-1/+1
| | | | llvm-svn: 160815
* [analyzer] Convert existing checkers to use check::preCall and check::postCall.Jordan Rose2012-07-021-63/+23
| | | | llvm-svn: 159563
* [analyzer] Finish replacing ObjCMessage with ObjCMethodDecl and friends.Jordan Rose2012-07-021-18/+11
| | | | | | | | The preObjCMessage and postObjCMessage callbacks now take an ObjCMethodCall argument, which can represent an explicit message send (ObjCMessageSend) or an implicit message generated by a property access (ObjCPropertyAccess). llvm-svn: 159559
* [analyzer] Begin replacing ObjCMessage with ObjCMethodCall and friends.Jordan Rose2012-07-021-2/+6
| | | | | | | | | | | | Previously, the CallEvent subclass ObjCMessageInvocation was just a wrapper around the existing ObjCMessage abstraction (over message sends and property accesses). Now, we have abstract CallEvent ObjCMethodCall with subclasses ObjCMessageSend and ObjCPropertyAccess. In addition to removing yet another wrapper object, this should make it easy to add a ObjCSubscriptAccess call event soon. llvm-svn: 159558
* [analyzer] Convert CallAndMessageChecker and ObjCSelfInitChecker to CallEvent.Jordan Rose2012-07-021-10/+39
| | | | | | | | | Both of these got uglier rather than cleaner because we don't have preCall and postCall yet; properly wrapping a CallExpr in a CallEvent requires doing a bit of deconstruction on the callee. Even when we have preCall and postCall we may want to expose the current CallEvent to pre/postStmt<CallExpr>. llvm-svn: 159556
* [analyzer] SelfInit: Stop tracking self if it's assigned a value weAnna Zaks2012-05-081-1/+25
| | | | | | | | | | | | | | 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
* [analyzer] Fix a false alarm in SelfInitChecker (radar://11235991).Anna Zaks2012-04-161-5/+20
| | | | | | Along with it, fix a couple of other corner cases and add more tests. llvm-svn: 154866
* Require that all static analyzer issues have a category. As part of this ↵Ted Kremenek2012-04-051-1/+1
| | | | | | | | | | 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
* [analyzer] False positive in SelfInit - teach the checker about methodAnna Zaks2012-03-051-10/+35
| | | | | | calls with self as a parameter. llvm-svn: 152039
* Adopt ExprEngine and checkers to ObjC property refactoring. Everything was ↵Ted Kremenek2012-02-181-1/+1
| | | | | | working, but now diagnostics are aware of message expressions implied by uses of properties. Fixes <rdar://problem/9241180>. llvm-svn: 150888
* [analyzer] Minor cleanups to the ObjCSelfInitChecker.Anna Zaks2012-02-041-15/+5
| | | | | | (Also renames in other ObjC checkers to create one category of checks.) llvm-svn: 149745
* Change references to 'const ProgramState *' to typedef 'ProgramStateRef'.Ted Kremenek2012-01-261-6/+6
| | | | | | | | At this point this is largely cosmetic, but it opens the door to replace ProgramStateRef with a smart pointer that more eagerly acts in the role of reclaiming unused ProgramState objects. llvm-svn: 149081
* [analyzer] Make the entries in 'Environment' context-sensitive by making ↵Ted Kremenek2012-01-061-5/+6
| | | | | | | | | | | | | | | | | | entries map from (Stmt*,LocationContext*) pairs to SVals instead of Stmt* to SVals. This is needed to support basic IPA via inlining. Without this, we cannot tell if a Stmt* binding is part of the current analysis scope (StackFrameContext) or part of a parent context. This change introduces an uglification of the use of getSVal(), and thus takes two steps forward and one step back. There are also potential performance implications of enlarging the Environment. Both can be addressed going forward by refactoring the APIs and optimizing the internal representation of Environment. This patch mainly introduces the functionality upon when we want to build upon (and clean up). llvm-svn: 147688
* [analyzer] Rename generateNode -> addTransition in CheckerContextAnna Zaks2011-10-261-3/+3
| | | | | | Also document addTransition methods. llvm-svn: 143059
* [analyzer] Simplify CheckerContextAnna Zaks2011-10-251-3/+3
| | | | | | | | | Remove dead members/parameters: ProgramState, respondsToCallback, autoTransition. Remove addTransition method since it's the same as generateNode. Maybe we should rename generateNode to genTransition (since a transition is always automatically generated)? llvm-svn: 142946
* Rename AnalysisContext to AnalysisDeclContext. Not only is this name more ↵Ted Kremenek2011-10-241-4/+4
| | | | | | accurate, but it frees up the name AnalysisContext for other uses. llvm-svn: 142782
* [analyzer] Remove the dependency on CheckerContext::getStmt() as well as the ↵Anna Zaks2011-10-061-1/+3
| | | | | | method itself. llvm-svn: 141262
* [analyzer] Remove TransferFuncs.h, then deal with the fallout.Jordy Rose2011-09-021-0/+1
| | | | | | And with that, TransferFuncs is gone! llvm-svn: 139003
* Remove EnhancedBugReport and RangedBugReport - pull all the extra ↵Anna Zaks2011-08-171-2/+2
| | | | | | functionality they provided into their parent BugReport. The only functional changes are: made getRanges() non const - it adds default range to Ranges if none are supplied, made getStmt() private, which was another FIXME. llvm-svn: 137894
* Rename GRState to ProgramState, and cleanup some code formatting along the way.Ted Kremenek2011-08-151-10/+10
| | | | llvm-svn: 137665
* Cleanup various declarations of 'Stmt*' to be 'Stmt *', etc. in libAnalyzer ↵Ted Kremenek2011-08-121-3/+3
| | | | | | and libStaticAnalyzer[*]. It was highly inconsistent, and very ugly to look at. llvm-svn: 137537
* fix a bunch of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129559
* Move some of the logic about classifying Objective-C methods intoJohn McCall2011-03-021-7/+2
| | | | | | | | conventional categories into Basic and AST. Update the self-init checker to use this logic; CFRefCountChecker is complicated enough that I didn't want to touch it. llvm-svn: 126817
* [analyzer] Rename CheckerV2 -> Checker.Argyrios Kyrtzidis2011-03-011-2/+2
| | | | llvm-svn: 126726
* [analyzer] Start moving the path-sensitive checkers to CheckerV2.Argyrios Kyrtzidis2011-02-221-56/+67
| | | | | | | | -Migrate ObjCSelfInitChecker to CheckerV2. In the process remove the 'preCallSelfFlags' field from the checker class and use GRState for storing that info. -Get ExprEngine to start delegating checker running to CheckerManager. llvm-svn: 126229
* [analyzer] Pass CheckerManager to the registration functions.Argyrios Kyrtzidis2011-02-171-1/+6
| | | | llvm-svn: 125777
* [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
* Weaken the ObjCSelfInitChecker to only warn when one calls an 'init' method ↵Ted Kremenek2011-02-121-7/+22
| | | | | | within an 'init' method. This is a temporary stop gap to avoid false positives while we investigate how to make it smarter. llvm-svn: 125427
* Split 'include/clang/StaticAnalyzer' into ↵Ted Kremenek2011-02-101-3/+3
| | | | | | | | 'include/clang/StaticAnalyzer/Core' and 'include/clang/StaticAnalyzer/Checkers'. This layout matches lib/StaticAnalyzer, which corresponds to two StaticAnalyzer libraries. llvm-svn: 125251
* [analyzer] lib/StaticAnalyzer/Checkers/ExprEngineInternalChecks.h -> ↵Argyrios Kyrtzidis2011-02-081-1/+1
| | | | | | lib/StaticAnalyzer/Checkers/InternalChecks.h llvm-svn: 125121
* [analyzer] Fix a false positive of the 'self' initialization checker.Argyrios Kyrtzidis2011-02-051-4/+20
| | | | | | | | | | | | | | | | | | | A common pattern in classes with multiple initializers is to put the subclass's common initialization bits into a static function that receives the value of 'self', e.g: if (!(self = [super init])) return nil; if (!(self = _commonInit(self))) return nil; It was reported that 'self' was not set to the result of [super init]. Until we can use inter-procedural analysis, in such a call, transfer the ObjCSelfInitChecker flags associated with 'self' to the result of the call. Fixes rdar://8937441 & http://llvm.org/PR9094 llvm-svn: 124940
* Fix the message. Thanks to Thomas Clement for noticing.Argyrios Kyrtzidis2011-02-011-1/+1
| | | | llvm-svn: 124680
* [analyzer] Slightly improve the diagnostic message of ObjCSelfInitChecker.Argyrios Kyrtzidis2011-02-011-2/+2
| | | | llvm-svn: 124674
* [analyzer] Improve the diagnostic for the self-init checker. Suggestion by Ted!Argyrios Kyrtzidis2011-01-261-4/+6
| | | | llvm-svn: 124263
* [analyzer] Do the self-init check only on NSObject subclasses. Patch by ↵Argyrios Kyrtzidis2011-01-251-2/+14
| | | | | | Jean-Daniel Dupas! llvm-svn: 124249
* [analyzer] Introduce ObjCMessage which represents both explicit ObjC message ↵Argyrios Kyrtzidis2011-01-251-8/+8
| | | | | | | | | | expressions and implicit messages that are sent for handling properties in dot syntax. Replace all direct uses of ObjCMessageExpr in the checkers and checker interface with ObjCMessage. llvm-svn: 124159
* [analyzer] Introduce ObjCSelfInitChecker, which checks initialization ↵Argyrios Kyrtzidis2011-01-111-0/+306
methods to verify that they assign 'self' to the result of an initialization call (e.g. [super init], or [self initWith..]) before using any instance variable or returning 'self'. llvm-svn: 123264
OpenPOWER on IntegriCloud