Commit Graph

12 Commits

Author SHA1 Message Date
Anna Zaks 99394bbd02 [analyzer] Fix a crash in RetainCountChecker - we should not rely on CallEnter::getCallExpr to return non-NULL
We get a CallEnter with a null expression, when processing a destructor. All other users of
CallEnter::getCallExpr work fine with null as return value.

(Addresses PR15832, Thanks to Jordan for reducing the test case!)

llvm-svn: 180234
2013-04-25 00:41:32 +00:00
Ted Kremenek 1f8e65d88e [analyzer] Add static initializer test case (from <rdar://problem/13227740>).
llvm-svn: 178321
2013-03-29 00:32:36 +00:00
Jordan Rose d65f1c8d6e [analyzer] RetainCountChecker: don't assume all functions have names.
Fixes a hard-to-reach crash when calling a non-member overloaded operator
with arguments that may be callbacks.

Future-proofing: don't make the same assumption in MallocSizeofChecker.
Aside from possibly respecting attributes in the future, it might be
possible to call 'malloc' through a function pointer.

I audited all other uses of FunctionDecl::getIdentifier() in the analyzer;
they all now correctly test to see if the identifier is present before
using it.

llvm-svn: 163012
2012-08-31 18:19:18 +00:00
Anna Zaks 90ab9bfa11 [analyzer]Malloc,RetainRelease: Allow pointer to escape via NSMapInsert.
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
2012-03-30 05:48:16 +00:00
Ted Kremenek 161046edab Avoid applying retain/release effects twice in RetainCountChecker when a function call was inlined (i.e., we do not need to apply summaries in such cases).
llvm-svn: 153309
2012-03-23 06:26:56 +00:00
Ted Kremenek 230e015b90 Add test case for <rdar://problem/10553686>, which illustrates RetainCount checker working with inlined C++ template functions.
llvm-svn: 153069
2012-03-20 00:10:35 +00:00
Jordy Rose 914e81ad94 [analyzer] Add test case from PR10794 for using 'new' with Obj-C objects.
llvm-svn: 152975
2012-03-17 03:53:59 +00:00
John McCall 525f05597f Tweak the interface for analyzing the CF conventions for a name
to take a FunctionDecl* instead of an llvm::StringRef.  Eventually
we might push more logic in there, like using slightly different
conventions for C++ methods.

Also, fix a bug where 'copy' and 'create' were being caught in 
non-camel-cased strings.  We want copyFoo and CopyFoo and XCopy
but not Xcopy or xcopy.

llvm-svn: 140911
2011-10-01 00:48:56 +00:00
Jordy Rose c49ec53e29 [analyzer] Move the knowledge of whether or not GC is enabled for the current analysis from CFRefCount to ExprEngine.
Remove TransferFuncs from ExprEngine and AnalysisConsumer.

Demote RetainReleaseChecker to a regular checker, and give it the name osx.cocoa.RetainCount (class name change coming shortly). Update tests accordingly.

llvm-svn: 138998
2011-09-02 05:55:19 +00:00
Douglas Gregor c9224d6714 Eliminate the -f[no]objc-infer-related-result-type flags; there's no
reason to allow the user to control these semantics through a flag.

llvm-svn: 132919
2011-06-13 16:42:53 +00:00
Ted Kremenek e9f364f658 Tweak the retain/release checker to not stop tracking retained objects when calling C++ methods. This is a temporary solution to prune false positives until we have a general story using annotations.
llvm-svn: 130726
2011-05-02 21:21:42 +00:00
Ted Kremenek aa181174e7 Augment retain/release checker to not warn about tracked objects passed as arguments to C++ constructors. This is a stop-gap measure for Objective-C++ code that uses smart pointers to manage reference counts.
llvm-svn: 130711
2011-05-02 19:42:42 +00:00