aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
AgeCommit message (Collapse)Author
2009-02-26Refine some grammar in the retain/release diagnostics.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65571 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-25Fix recently introduced switch case fallthrough bug.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65485 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-25retain/release checker: Implement basic tracking of autorelease stack. Next ↵Ted Kremenek
thing is to wire up pools with their contents. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65425 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-24Fix broken logic from my last commit. Branches only occur at basic blocks ↵Ted Kremenek
that end with terminators. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65410 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-24Fix diagnostic regression where the leak diagnostic could appear earlier in ↵Ted Kremenek
the path than the branches taken. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-24retain/release checker:Ted Kremenek
- For autorelease pool tracking, keep information about the stack of pools separate from their contents. Also, keep track of the number of times an autorelease pool will send the "release" message to an object when the pool is destroyed. - Update CFRefCount::Update to return a new state instead of a reference count binding. This will allow us to implement more complicated semantics with autorelease pools. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65384 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-23Add more boilerplate logic to more accurately reason about autorelease pools.Ted Kremenek
This doesn't change the current functionality, but better codifies the autorelease pool stack itself. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65328 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-23Fix 80 col. violations.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-23Per Chris L.'s suggestion, use getAsFunctionType() instead of ↵Ted Kremenek
getDesguaredType(). Constify some pointers along the way. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65321 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-23retain/release checker: For now don't track the retain count of NSWindow ↵Ted Kremenek
objects (opt for false negatives). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65304 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-23Remove typo.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65302 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-23'[NSAutoreleasePool addObject:]' has an 'autorelease' effect, not a ↵Ted Kremenek
DoNothing effect. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65301 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-22Fix regression in naming convention derivation: a method only follows the ↵Ted Kremenek
copy 'rule' if it doesn't already start with 'init', etc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65269 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-21Use llvm::StringsEqualNoCase instead of strncasecmp.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65237 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-21Fix build on windows.Cedric Venet
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 :)). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65233 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-21Improved naming convention heuristics in the retain/release checker to betterTed Kremenek
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>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65224 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20Fix crash from <rdar://problem/6562655>: 'init' method only return a ↵Ted Kremenek
receiver alias if the return type is a location. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65084 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-19retain/release checker: Generate an intermediate simulation node for "leak"Ted Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65082 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-19retain/release checker: Fix crasher when the leak site is the same ↵Ted Kremenek
expression that allocates an object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65047 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18retain/release checker: Place the leak diagnostic after the last statement thatTed Kremenek
references the tracked object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64980 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18Remove unused variable.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64974 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18Remove logic for computing 'display hint'.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18More fun with retain checker diagnostics:Ted Kremenek
- 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64971 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18Fix diagnostics bugs when computing ranges for the retain/release checker.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64962 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18retain/release checker: We now emit fancy diagnostics telling users about theTed Kremenek
semantics of CFMakeCollectable and friends. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64956 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18retain/release checker: Distinguish in the function summaries betweenTed Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64937 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18Hooked up the necessary machinery to allow the retain/release checker referenceTed Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64881 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18retain/release checker: Record the summary used to generate a given node.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64876 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-14Added GRStateManager::scanReachableSymbols(), a method which scans the reachableTed Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64534 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-14Static analyzer:Ted Kremenek
- 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64525 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12Several cleanups:Steve Naroff
- 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07Fix null dereference.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64044 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07For retain/release leaks, have the BugReport description indicate the ↵Ted Kremenek
allocation site and initial bindings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64041 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07Determining the allocation site for a leak when constructing a ↵Ted Kremenek
CFRefLeakReport. This avoids repeated calls to GetAllocationSite when Profiling a CFRefLeakReport object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64036 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07Split logic for 'getEndPath()' for CFRefReport and CFRefLeakReport.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64034 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07Convert a use of 'std::ostringstream' to 'llvm::raw_string_ostream'.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64033 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05Add 'AppendValue' to the list of magic CF function names that cause a ↵Ted Kremenek
tracked object to escape. Fixes <rdar://problem/6560661>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63891 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05Remove a bunch of obscene double-buffering of BugReports in the retain/releaseTed Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63840 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05Fix regression: Leak (BugType) object should have 'isLeak()' return true.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63803 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04Overhaul BugReporter interface and implementation. The new interface cleans upTed Kremenek
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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63796 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29retain/release checker: When generating summaries for CF/CG functions, allow ↵Ted Kremenek
arguments to "escape" if they are passed to a function containing the terms "InsertValue", "SetValue", or "AddValue". This fixes <rdar://problem/6539791>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63341 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28Remove '#if 0' code.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63250 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28Remove method 'AddNE' from the public interface of ConstraintManager.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63249 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28retain/release checker: Always generate an "autorelease" summary for an ↵Ted Kremenek
"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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63241 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28retain/release checker: Improve diagnostics to indicate that CF objects are ↵Ted Kremenek
not automatically garbage collected. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63187 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28retain/release checker: Indicate whether a tracked object is a Core ↵Ted Kremenek
Foundation or Objective-C object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63186 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28retain/release checker: More diagnostic refactoring.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63184 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28retain/release checker: Embed an "object type" into the RetEffect/RetVal ↵Ted Kremenek
objects to help distinguish between Objective-C and Core Foundation objects (for better diagnostics). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63183 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28retain/release checker: More cleanups (no real functionality change).Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63181 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28Fix diagnostic truncated by my last patch.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63180 91177308-0d34-0410-b5e6-96231b3b80d8