summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] Allow IvarInvalidation checker to suppress warnings viaAnna Zaks2013-01-101-6/+14
| | | | | | | | | | | | assertions. To ensure that custom assertions/conditional would also be supported, just check if the ivar that needs to be invalidated or set to nil is compared against 0. Unfortunately, this will not work for code containing 'assert(IvarName)' llvm-svn: 172147
* [analyzer] Fix non-determinizm introduced in r172104.Anna Zaks2013-01-101-17/+29
| | | | | | | | In some cases, we just pick any ivar that needs invalidation and attach the warning to it. Picking the first from DenseMap of pointer keys was triggering non-deterministic output. llvm-svn: 172134
* [analyzer] Add more checks to the ObjC Ivar Invalidation checker.Anna Zaks2013-01-101-57/+118
| | | | | | | | | | | | | | Restructured the checker so that it could easily find two new classes of issues: - when a class contains an invalidatable ivar, but no declaration of an invalidation method - when a class contains an invalidatable ivar, but no definition of an invalidation method in the @implementation. The second case might trigger some false positives, for example, when the method is defined in a category. llvm-svn: 172104
* Do not model loads from complex types, since we don't accurately model the ↵Ted Kremenek2013-01-091-0/+5
| | | | | | | | imaginary and real parts yet. Fixes false positive reported in <rdar://problem/12964481>. llvm-svn: 171987
* [analyzer] Only include uniqueling location as issue_hash when availableAnna Zaks2013-01-081-11/+18
| | | | | | | This makes us more optimistic when matching reports in a changing code base. Addresses Jordan's feedback for r171825. llvm-svn: 171884
* [analyzer] Include the bug uniqueing location in the issue_hash.Anna Zaks2013-01-085-34/+63
| | | | | | | | | | | | | | | The issue here is that if we have 2 leaks reported at the same line for which we cannot print the corresponding region info, they will get treated as the same by issue_hash+description. We need to AUGMENT the issue_hash with the allocation info to differentiate the two issues. Add the "hash" (offset from the beginning of a function) representing allocation site to solve the issue. We might want to generalize solution in the future when we decide to track more than just the 2 locations from the diagnostics. llvm-svn: 171825
* [analyzer] Plist: change the type of issue_hash from int to string.Anna Zaks2013-01-081-2/+2
| | | | | | This gives more flexibility to what could be stored as issue_hash. llvm-svn: 171824
* [analyzer] Fix a false positive in Secure Keychain API checker.Anna Zaks2013-01-072-8/+10
| | | | | | | | | Better handle the blacklisting of known bad deallocators when symbol escapes through a call to CFStringCreateWithBytesNoCopy. Addresses radar://12702952. llvm-svn: 171770
* [analyzer] Fix a false positive in the ivar invalidation checker.Anna Zaks2013-01-071-1/+3
| | | | | | | | | When a property is "inherited" through both a parent class and directly through a protocol, we should not require the child to invalidate it since the backing ivar belongs to the parent class. (Fixes radar://12913734) llvm-svn: 171769
* NSErrorChecker: remove quoting the parameter name in the diagnostic until we ↵Ted Kremenek2013-01-041-11/+8
| | | | | | | | | | actually include it's name. This is a possible regression of moving to using ImplicitNullDerefEvent. Fixing this for real (including the parameter name) requires more plumbing in ImplicitNullDerefEvent. This is just a stop gap fix. llvm-svn: 171502
* Tighten code. No functionality change.Ted Kremenek2013-01-041-7/+7
| | | | llvm-svn: 171501
* Make MallocChecker debug output useful.Ted Kremenek2013-01-031-2/+22
| | | | llvm-svn: 171439
* [analyzer] Rename callback EndPath -> EndFunctionAnna Zaks2013-01-036-25/+25
| | | | | | | This better reflects when callback is called and what the checkers are relying on. (Both names meant the same pre-IPA.) llvm-svn: 171432
* Re-sort #include lines using the llvm/utils/sort_includes.py script.Chandler Carruth2013-01-022-2/+2
| | | | | | | Removes a duplicate #include as well as cleaning up some sort order regressions since I last ran the script over Clang. llvm-svn: 171364
* Fix typo: objc_no_direct_instance_variable_assignmemt => ↵Ted Kremenek2012-12-222-3/+3
| | | | | | | | objc_no_direct_instance_variable_assignment. Fixes <rdar://problem/12927551>. llvm-svn: 170971
* [analyzer] Convert SimpleStreamChecker to use the PointerEscape callbackAnna Zaks2012-12-221-80/+16
| | | | | | The new callback greatly simplifies the checker. llvm-svn: 170969
* [analyzer] Re-apply r170826 and make the dumping of the GallGraphAnna Zaks2012-12-211-44/+18
| | | | | | | | | | | | | | | | | | | | | | | deterministic. Commit message for r170826: [analyzer] Traverse the Call Graph in topological order. Modify the call graph by removing the parentless nodes. Instead all nodes are children of root to ensure they are all reachable. Remove the tracking of nodes that are "top level" or global. This information is not used and can be obtained from the Decls stored inside CallGraphNodes. Instead of existing ordering hacks, analyze the functions in topological order over the Call Graph. Together with the addition of devirtualizable ObjC message sends and blocks to the call graph, this gives around 6% performance improvement on several large ObjC benchmarks. llvm-svn: 170906
* Remove duplicate includes.Roman Divacky2012-12-211-1/+0
| | | | llvm-svn: 170903
* [analyzer] Address Jordan's nitpicks as per code review of r170625.Anna Zaks2012-12-216-18/+15
| | | | llvm-svn: 170832
* Revert r170826. The output ofRafael Espindola2012-12-211-18/+44
| | | | | | | | ./bin/clang -cc1 -internal-isystem /home/espindola/llvm/build/lib/clang/3.3/include/ -analyze -analyzer-checker=debug.DumpCallGraph /home/espindola/llvm/clang/test/Analysis/debug-CallGraph.c -fblocks changes in each run. llvm-svn: 170829
* [analyzer] Traverse the Call Graph in topological order.Anna Zaks2012-12-211-44/+18
| | | | | | | | | | | | | | | | | Modify the call graph by removing the parentless nodes. Instead all nodes are children of root to ensure they are all reachable. Remove the tracking of nodes that are "top level" or global. This information is not used and can be obtained from the Decls stored inside CallGraphNodes. Instead of existing ordering hacks, analyze the functions in topological order over the Call Graph. Together with the addition of devirtualizable ObjC message sends and blocks to the call graph, this gives around 6% performance improvement on several large ObjC benchmarks. llvm-svn: 170826
* [analyzer] Add blocks and ObjC messages to the call graph.Anna Zaks2012-12-211-30/+18
| | | | | | | | | | | This paves the road for constructing a better function dependency graph. If we analyze a function before the functions it calls and inlines, there is more opportunity for optimization. Note, we add call edges to the called methods that correspond to function definitions (declarations with bodies). llvm-svn: 170825
* Update RetainCountChecker to understand attribute ns_returns_autoreleased.Ted Kremenek2012-12-201-4/+6
| | | | | | Fixes <rdar://problem/12887356>. llvm-svn: 170724
* [analyzer] Add the pointer escaped callback.Anna Zaks2012-12-2010-116/+204
| | | | | | | | | | Instead of using several callbacks to identify the pointer escape event, checkers now can register for the checkPointerEscape. Converted the Malloc checker to use the new callback. SimpleStreamChecker will be converted next. llvm-svn: 170625
* Pass AnalyzerOptions to PathDiagnosticConsumer to make analyzer options ↵Ted Kremenek2012-12-194-14/+28
| | | | | | | | accessible there. This is plumbing needed for later functionality changes. llvm-svn: 170488
* Don't include the header outside the include guards, it defeats the purpose ↵Argyrios Kyrtzidis2012-12-171-2/+2
| | | | | | of the include guards. llvm-svn: 170364
* [analyzer] Tweak the NumFunctionsAnalyzed stat so that it's more useful.Anna Zaks2012-12-171-3/+5
| | | | llvm-svn: 170362
* [analyzer] Implement "do not inline large functions many times"Anna Zaks2012-12-172-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | performance heuristic After inlining a function with more than 13 basic blocks 32 times, we are not going to inline it anymore. The idea is that inlining large functions leads to drastic performance implications. Since the function has already been inlined, we know that we've analyzed it in many contexts. The following metrics are used: - Large function is a function with more than 13 basic blocks (we should switch to another metric, like cyclomatic complexity) - We consider that we've inlined a function many times if it's been inlined 32 times. This number is configurable with -analyzer-config max-times-inline-large=xx This heuristic addresses a performance regression introduced with inlining on one benchmark. The analyzer on this benchmark became 60 times slower with inlining turned on. The heuristic allows us to analyze it in 24% of the time. The performance improvements on the other benchmarks I've tested with are much lower - under 10%, which is expected. llvm-svn: 170361
* fixed line endingsAnton Yartsev2012-12-141-22/+22
| | | | llvm-svn: 170238
* added post-statement callback to CXXNewExpr and pre-statement callback to ↵Anton Yartsev2012-12-141-15/+22
| | | | | | CXXDeleteExpr llvm-svn: 170234
* [analyzer] Propagate the checker's state from checkBranchConditionAnna Zaks2012-12-141-3/+3
| | | | | | | Fixes a bug, where we were dropping the state modifications from the checkBranchCondition checker callback. llvm-svn: 170232
* [analyzer] Refactor: Store visited Decls instead of CallGraphNodes.Anna Zaks2012-12-141-24/+22
| | | | llvm-svn: 170231
* Refactor dump methods to make RegionBindingsRef printable in the debugger.Ted Kremenek2012-12-141-9/+16
| | | | llvm-svn: 170170
* [analyzer] Fix doc error (wrong param name) in ObjCSuperCallChecker.Jordan Rose2012-12-131-1/+1
| | | | | | Thanks for the -Wdocumentation catch, Dmitri! llvm-svn: 170139
* [analyzer] Generalize ObjCMissingSuperCallChecker.Jordan Rose2012-12-131-43/+109
| | | | | | | | We now check a few methods for UIResponder, NSResponder, and NSDocument. Patch by Julian Mayer! llvm-svn: 170089
* [analyzer] Fix a self-init checker false positive.Anna Zaks2012-12-131-2/+7
| | | | | | | | | | | This is a Band-Aid fix to a false positive, where we complain about not initializing self to [super init], where self is not coming from the init method, but is coming from the caller to init. The proper solution would be to associate the self and it's state with the enclosing init. llvm-svn: 170059
* [analyzer] Don't crash running destructors for multidimensional arrays.Jordan Rose2012-12-121-1/+2
| | | | | | | | | | We don't handle array destructors correctly yet, but we now apply the same hack (explicitly destroy the first element, implicitly invalidate the rest) for multidimensional arrays that we already use for linear arrays. <rdar://problem/12858542> llvm-svn: 170000
* [analyzer] Don't generate a summary for "freeWhenDone" if method isAnna Zaks2012-12-111-0/+3
| | | | | | | | | inlined. Fixes a false positive that occurs if a user writes their own initWithBytesNoCopy:freeWhenDone wrapper. llvm-svn: 169795
* [analyzer] Optimization heuristic: do not reanalyze every ObjC method asAnna Zaks2012-12-073-20/+66
| | | | | | | | | | | | | | | | | | top level. This heuristic is already turned on for non-ObjC methods (inlining-mode=noredundancy). If a method has been previously analyzed, while being inlined inside of another method, do not reanalyze it as top level. This commit applies it to ObjCMethods as well. The main caveat here is that to catch the retain release errors, we are still going to reanalyze all the ObjC methods but without inlining turned on. Gives 21% performance increase on one heavy ObjC benchmark, which suffered large performance regressions due to ObjC inlining. llvm-svn: 169639
* [analyzer] Fix r168019 to work with unpruned paths as well.Jordan Rose2012-12-071-24/+44
| | | | | | | | | | | | | This is the case where the analyzer tries to print out source locations for code within a synthesized function body, which of course does not have a valid source location. The previous fix attempted to do this during diagnostic path pruning, but some diagnostics have pruning disabled, and so any diagnostic with a path that goes through a synthesized body will either hit an assertion or emit invalid output. <rdar://problem/12657843> (again) llvm-svn: 169631
* Reduce conversions between Store <-> ImmutableMapRef in RegionStore.Ted Kremenek2012-12-071-147/+151
| | | | | | | This reduces canonicalization of ImmutableMaps. This reduces analysis time of one heavy Objective-C file by another 1%. llvm-svn: 169630
* Add helper method to convert from a RegionStoreRefBindings to a Store.Ted Kremenek2012-12-071-8/+13
| | | | llvm-svn: 169622
* Cache queries to lookupPrivateMethod() within ↵Ted Kremenek2012-12-071-1/+29
| | | | | | | | | ObjCMethodCall::getRuntimeDefinition(). The same queries can happen thousands of times. This reduces the analysis time on one heavy Objective-C file by 2.4%. llvm-svn: 169589
* Further reduce analysis time by 0.2% on a heavy Objective-C example by ↵Ted Kremenek2012-12-071-8/+9
| | | | | | avoiding over-eager canonicalization of clusters. llvm-svn: 169586
* Unbreak the GCC (4.4 & other bot) builds from r169571.David Blaikie2012-12-071-2/+4
| | | | llvm-svn: 169581
* Change RegionStore to always use ImmutableMapRef for processing cluster ↵Ted Kremenek2012-12-071-224/+250
| | | | | | | | | | | | | | bindings. This reduces analysis time by 1.2% on one test case (Objective-C), but also cleans up some of the code conceptually as well. We can possible just make RegionBindingsRef -> RegionBindings, but I wanted to stage things. After this, we should revisit Jordan's optimization of not canonicalizing the immutable AVL trees for the cluster bindings as well. llvm-svn: 169571
* Revert "[analyzer] Aggressively cut back on the canonicalization in ↵Ted Kremenek2012-12-061-37/+31
| | | | | | | | RegionStore." Jordan and I discussed this, and we are going to do this another way. llvm-svn: 169538
* [analyzer] Remove isa<> followed by dyn_cast<>.Jordan Rose2012-12-061-7/+6
| | | | llvm-svn: 169530
* [analyzer] Remove unused fields from ExprEngine.Jordan Rose2012-12-062-17/+10
| | | | | | | 'currStmt', 'CleanedState', and 'EntryNode' were being set, but only ever used locally. llvm-svn: 169529
* [analyzer] Remove checks that predate the linearized CFG.Jordan Rose2012-12-061-10/+1
| | | | llvm-svn: 169528
OpenPOWER on IntegriCloud