summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFRefCount.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix regression in naming convention derivation: a method only follows the ↵Ted Kremenek2009-02-221-1/+1
| | | | | | copy 'rule' if it doesn't already start with 'init', etc. llvm-svn: 65269
* Use llvm::StringsEqualNoCase instead of strncasecmp.Ted Kremenek2009-02-211-8/+5
| | | | llvm-svn: 65237
* Fix build on windows.Cedric Venet2009-02-211-0/+4
| | | | | | Should clang have a config.h or should we use the config.h of llvm or using the preprocessor is OK? I did a quick fix here, but having a guideline on how to handle non portable function would be great (or ask ted to stop breaking the windows build :)). llvm-svn: 65233
* Improved naming convention heuristics in the retain/release checker to betterTed Kremenek2009-02-211-9/+94
| | | | | | | | | handle method names that contain 'new', 'copy', etc., but those words might be the substring of larger words such as 'newsgroup' and 'photocopy' that do not indicate the allocation of objects. This should address the issues discussed in <rdar://problem/6552389>. llvm-svn: 65224
* Fix crash from <rdar://problem/6562655>: 'init' method only return a ↵Ted Kremenek2009-02-201-2/+5
| | | | | | receiver alias if the return type is a location. llvm-svn: 65084
* retain/release checker: Generate an intermediate simulation node for "leak"Ted Kremenek2009-02-191-17/+38
| | | | | | | | transitions and then generate a subsequent node that removes the dead symbol bindings. This should drastically improve caching in the simulation graph when retain-counted objects are being tracked. llvm-svn: 65082
* retain/release checker: Fix crasher when the leak site is the same ↵Ted Kremenek2009-02-191-12/+20
| | | | | | expression that allocates an object. llvm-svn: 65047
* retain/release checker: Place the leak diagnostic after the last statement thatTed Kremenek2009-02-181-15/+37
| | | | | | references the tracked object. llvm-svn: 64980
* Remove unused variable.Ted Kremenek2009-02-181-1/+0
| | | | llvm-svn: 64974
* Remove logic for computing 'display hint'.Ted Kremenek2009-02-181-21/+2
| | | | llvm-svn: 64973
* More fun with retain checker diagnostics:Ted Kremenek2009-02-181-7/+17
| | | | | | | | - Fix some grammar. - Fix a bug where a "reference count incremented" diagnostic would not be shown if the previous typestate was "Released" (only happens in GC mode). llvm-svn: 64971
* Fix diagnostics bugs when computing ranges for the retain/release checker.Ted Kremenek2009-02-181-1/+4
| | | | llvm-svn: 64962
* retain/release checker: We now emit fancy diagnostics telling users about theTed Kremenek2009-02-181-50/+88
| | | | | | semantics of CFMakeCollectable and friends. llvm-svn: 64956
* retain/release checker: Distinguish in the function summaries betweenTed Kremenek2009-02-181-12/+27
| | | | | | | | retain/releases performed via [... release] and CFRetain(). The former are no-ops in GC. The checker already handled this, but now we emit nice diagnostics to the user telling them that these are no-ops. llvm-svn: 64937
* Hooked up the necessary machinery to allow the retain/release checker referenceTed Kremenek2009-02-181-53/+125
| | | | | | | | | | | | | back to the summary used when evaluating the statement associated with a simulation node. This is now being used to help improve the checker's diagnostics. To get things started, the checker now emits a path diagnostic indicating that 'autorelease' is a no-op in GC mode. Some of these changes are exposing further grossness in the interface between BugReporter and the ExplodedGraph::Trim facilities. These really need to be cleaned up one day. llvm-svn: 64881
* retain/release checker: Record the summary used to generate a given node.Ted Kremenek2009-02-181-5/+10
| | | | llvm-svn: 64876
* Added GRStateManager::scanReachableSymbols(), a method which scans the reachableTed Kremenek2009-02-141-14/+26
| | | | | | | | | | | | | symbols from an SVal. - Fixed a bug in EnvironmentManager::RemoveDeadBindings() where it did not mark live all the symbols reachable from a live block-level expression. - Fixed a bug in the retain/release checker where it did not stop tracking symbols that 'escaped' via compound literals being assigned to something the BasicStoreManager didn't reason about. llvm-svn: 64534
* Static analyzer:Ted Kremenek2009-02-141-44/+22
| | | | | | | | | | | | | | | | | | | | - Added a new 'node builder' class called GRStmtNodeBuilderRef (name may change). This is essentially a smart reference to a GRStmtNodeBuilder object that keeps track of the current context (predecessor node, GRExprEngine object, etc.) The idea is to gradually simplify the interface between GRExprEngine and GRTransferFuncs using this new builder (i.e., passing 1 argument instead of 5). It also handles some of the "auto-transition" for node creation, simplifying some of the logic in GRExprEngine itself. - Used GRStmtBuilderRef to replace GRTransferFuncs::EvalStore with GRTransferFuncs::EvalBind. The new EvalBind method will be used at any arbitrary places where a binding between a location and value takes place. Moreover, GRTransferFuncs no longer has the responsibility to request StoreManager to do the binding; this is now in GRExprEngine::EvalBind. All GRTransferFuncs::EvalBind does is checker-specific logic (which can be a no-op). llvm-svn: 64525
* Several cleanups:Steve Naroff2009-02-121-1/+1
| | | | | | | | - rename isObjCIdType/isObjCClassType -> isObjCIdStructType/isObjCClassStructType. The previous name didn't do what you would expect. - add back isObjCIdType/isObjCClassType to do what you would expect. Not currently used, however many of the isObjCIdStructType/isObjCClassStructType clients could be converted over time. - move static Sema function areComparableObjCInterfaces to ASTContext (renamed to areComparableObjCPointerTypes, since it now operates on pointer types). llvm-svn: 64385
* Fix null dereference.Ted Kremenek2009-02-071-2/+5
| | | | llvm-svn: 64044
* For retain/release leaks, have the BugReport description indicate the ↵Ted Kremenek2009-02-071-12/+15
| | | | | | allocation site and initial bindings. llvm-svn: 64041
* Determining the allocation site for a leak when constructing a ↵Ted Kremenek2009-02-071-17/+34
| | | | | | CFRefLeakReport. This avoids repeated calls to GetAllocationSite when Profiling a CFRefLeakReport object. llvm-svn: 64036
* Split logic for 'getEndPath()' for CFRefReport and CFRefLeakReport.Ted Kremenek2009-02-071-8/+18
| | | | llvm-svn: 64034
* Convert a use of 'std::ostringstream' to 'llvm::raw_string_ostream'.Ted Kremenek2009-02-071-3/+2
| | | | llvm-svn: 64033
* Add 'AppendValue' to the list of magic CF function names that cause a ↵Ted Kremenek2009-02-051-1/+2
| | | | | | tracked object to escape. Fixes <rdar://problem/6560661>. llvm-svn: 63891
* Remove a bunch of obscene double-buffering of BugReports in the retain/releaseTed Kremenek2009-02-051-181/+137
| | | | | | | | | | checker. This was previously needed because BugReport objects were previously allocated on the stack and not owned by BugReporter. Now we can just issue them on the fly. This change was motivated because we were seeing some weird cases where some really long paths would get issued for bugs (particularly leaks) because of some double-caching. llvm-svn: 63840
* Fix regression: Leak (BugType) object should have 'isLeak()' return true.Ted Kremenek2009-02-051-0/+2
| | | | llvm-svn: 63803
* Overhaul BugReporter interface and implementation. The new interface cleans upTed Kremenek2009-02-041-96/+91
| | | | | | | | | | | | | | | | | | | | | the ownership of BugTypes and BugReports. Now BugReports are owned by BugTypes, and BugTypes are owned by the BugReporter object. The major functionality change in this patch is that reports are not immediately emitted by a call to BugReporter::EmitWarning (now called EmitReport), but instead of queued up in report "equivalence classes". When BugReporter::FlushReports() is called, it emits one diagnostic per report equivalence class. This provides a nice cleanup with the caching of reports as well as enables the BugReporter engine to select the "best" path for reporting a path-sensitive bug based on all the locations in the ExplodedGraph that the same bug could occur. Along with this patch, Leaks are now coalesced into a common equivalence class by their allocation site, and the "summary" diagnostic for leaks now reports the allocation site as the location of the bug (this may later be augmented to also provide an example location where the leak occurs). llvm-svn: 63796
* retain/release checker: When generating summaries for CF/CG functions, allow ↵Ted Kremenek2009-01-291-6/+21
| | | | | | arguments to "escape" if they are passed to a function containing the terms "InsertValue", "SetValue", or "AddValue". This fixes <rdar://problem/6539791>. llvm-svn: 63341
* Remove '#if 0' code.Ted Kremenek2009-01-281-5/+0
| | | | llvm-svn: 63250
* Remove method 'AddNE' from the public interface of ConstraintManager.Ted Kremenek2009-01-281-2/+5
| | | | llvm-svn: 63249
* retain/release checker: Always generate an "autorelease" summary for an ↵Ted Kremenek2009-01-281-9/+9
| | | | | | "autorelease" message, and have the summary processing logic treat it as a no-op in GC mode. This change is motivated to encode more of the semantics in the summaries themselves for eventual better diagnostics. llvm-svn: 63241
* retain/release checker: Improve diagnostics to indicate that CF objects are ↵Ted Kremenek2009-01-281-2/+9
| | | | | | not automatically garbage collected. llvm-svn: 63187
* retain/release checker: Indicate whether a tracked object is a Core ↵Ted Kremenek2009-01-281-1/+7
| | | | | | Foundation or Objective-C object. llvm-svn: 63186
* retain/release checker: More diagnostic refactoring.Ted Kremenek2009-01-281-6/+4
| | | | llvm-svn: 63184
* retain/release checker: Embed an "object type" into the RetEffect/RetVal ↵Ted Kremenek2009-01-281-42/+53
| | | | | | objects to help distinguish between Objective-C and Core Foundation objects (for better diagnostics). llvm-svn: 63183
* retain/release checker: More cleanups (no real functionality change).Ted Kremenek2009-01-281-15/+10
| | | | llvm-svn: 63181
* Fix diagnostic truncated by my last patch.Ted Kremenek2009-01-281-0/+2
| | | | llvm-svn: 63180
* retain/release checker: More diagnostic refactoring.Ted Kremenek2009-01-281-27/+15
| | | | llvm-svn: 63179
* retain/release checker: Output the name of the function that allocates an ↵Ted Kremenek2009-01-281-14/+15
| | | | | | object. llvm-svn: 63178
* Refactor some diagnostic code to use raw_string_ostream. No functionality ↵Ted Kremenek2009-01-281-20/+17
| | | | | | change. llvm-svn: 63177
* Remove '#if 0' code.Ted Kremenek2009-01-281-5/+0
| | | | llvm-svn: 63176
* More hacking on static analyzer diagnostics. When emitting summary ↵Ted Kremenek2009-01-241-26/+22
| | | | | | diagnostics the code paths for diagnostics involving paths or single locations are now unified. This patch also constifies many arguments/methods that are touched by this logic, leading to a nice overall code cleanup. llvm-svn: 62903
* Static Analyzer: Replace LiveSymbols/DeadSymbols sets with a new object ↵Ted Kremenek2009-01-211-9/+7
| | | | | | called "SymbolReaper". Right now it just consolidates the two and cleans up some client code, but shortly it will be used to enable "lazy computation" of live symbols for use with RegionStore. llvm-svn: 62722
* Fix PR 3337 [retain/release checker]: Handle FunctionDecl's declared using ↵Ted Kremenek2009-01-161-1/+3
| | | | | | typedefs. llvm-svn: 62331
* more SourceLocation lexicon change: instead of referring to theChris Lattner2009-01-161-3/+3
| | | | | | "logical" location, refer to the "instantiation" location. llvm-svn: 62316
* retain/release checker:Ted Kremenek2009-01-121-177/+123
| | | | | | | | | | | | | | - Refactor a bunch of logic in the retain/release checker, making it more condense and easier to read. - Add support for "Create" methods in the DiskArbitration framework retain/release tests: - Rename CFDate.m to retain-release.m, and move test from CFString.c to retain-release.m - Add DiskArbitration framework tests cases. - Add/refine and few more retain/release GC test cases. llvm-svn: 62106
* This commit reflects changes to the retain/release checker motivated by myTed Kremenek2009-01-071-36/+42
| | | | | | | | | | | | | | | | | | | | | | | recent discussions with Thomas Clement and Ken Ferry concerning the "fundamental rule" for Cocoa memory management (http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html). Here is the revised behavior of the checker concerning tracking retain/release counts for objects returned from message expressions involving instance methods: 1) Track the returned object if the return type of the message expression is id<..>, id, or a pointer to *any* object that subclasses NSObject. Such objects are assumed to have a retain count. Previously the checker only tracked objects when the receiver of the message expression was part of the standard Cocoa API (i.e., had class names prefixed with 'NS'). This should significantly expand the amount of checking performed. 2) Consider the object owned if the selector of the message expression contains "alloc", "new", or "copy". Previously we also considered "create", but this doesn't follow from the fundamental rule (discussions with the Cocoa folks confirms this). llvm-svn: 61837
* Fix regression when invalidating reference-counts for objects ↵Ted Kremenek2008-12-181-8/+9
| | | | | | passed-by-reference to a function/method. llvm-svn: 61224
* Fix <rdar://problem/6451816>:Ted Kremenek2008-12-171-1/+9
| | | | | | | | | | | | | | | | - Because of the introduction of AnonTypedRegions when reasoning about casts, we had a regression in the "symbolication" of variable values passed-by-reference to a function. This is now fixed in CFRefCount.cpp (-checker-cfref) by blasting through the layer of AnonTypedRegions when symbolicating the value of the variable. This logic may get moved elsewhere. Note that this change affects only -checker-cfref and not -checker-simple; eventually this logic should get pulled out of CFRefCount.cpp into a more common place. All users use -checker-cfref by default, and -checker-simple should probably just be removed. - Updated test 'Analysis/uninit-vals-ps.c' to only use -checker-cfref and added a test case for this regression. llvm-svn: 61147
OpenPOWER on IntegriCloud