summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ParentMap.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [arcmt] More automatic transformations and safety improvements; rdar://9615812 :Argyrios Kyrtzidis2011-07-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Replace calling -zone with 'nil'. -zone is obsolete in ARC. - Allow removing retain/release on a static global var. - Fix assertion hit when scanning for name references outside a NSAutoreleasePool scope. - Automatically add bridged casts for results of objc method calls and when calling CFRetain, for example: NSString *s; CFStringRef ref = [s string]; -> CFStringRef ref = (__bridge CFStringRef)([s string]); ref = s.string; -> ref = (__bridge CFStringRef)(s.string); ref = [NSString new]; -> ref = (__bridge_retained CFStringRef)([NSString new]); ref = [s newString]; -> ref = (__bridge_retained CFStringRef)([s newString]); ref = [[NSString alloc] init]; -> ref = (__bridge_retained CFStringRef)([[NSString alloc] init]); ref = [[s string] retain]; -> ref = (__bridge_retained CFStringRef)([s string]); ref = CFRetain(s); -> ref = (__bridge_retained CFTypeRef)(s); ref = [s retain]; -> ref = (__bridge_retained CFStringRef)(s); - Emit migrator error when trying to cast to CF type the result of autorelease/release: for CFStringRef f3() { return (CFStringRef)[[[NSString alloc] init] autorelease]; } emits: t.m:12:10: error: [rewriter] it is not safe to cast to 'CFStringRef' the result of 'autorelease' message; a __bridge cast may result in a pointer to a destroyed object and a __bridge_retained may leak the object return (CFStringRef)[[[NSString alloc] init] autorelease]; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.m:12:3: note: [rewriter] remove the cast and change return type of function to 'NSString *' to have the object automatically autoreleased return (CFStringRef)[[[NSString alloc] init] autorelease]; ^ - Before changing attributes to weak/unsafe_unretained, check if the backing ivar is set to a +1 object, in which case use 'strong' instead. llvm-svn: 136208
* Automatic Reference Counting.John McCall2011-06-151-0/+9
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Give some convenient idiomatic accessors to Stmt::child_range andJohn McCall2011-02-131-1/+1
| | | | | | | Stmt::const_child_range, then make a bunch of places use them instead of the individual iterator accessors. llvm-svn: 125450
* Don't emit a dead store for '++' operations unless it occurs with a return ↵Ted Kremenek2011-02-121-0/+9
| | | | | | | | statement. We've never seen any other cases that were real bugs. Fixes <rdar://problem/6962292>. llvm-svn: 125419
* Add method ParentMap::addStmt().Ted Kremenek2010-11-151-0/+6
| | | | llvm-svn: 119181
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-1/+1
| | | | | | to the new constants. llvm-svn: 112047
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-5/+5
| | | | llvm-svn: 81346
* Add ParentMap:getParentIgnoreParens().Ted Kremenek2009-05-111-0/+5
| | | | llvm-svn: 71469
* Fix subtle bug in ParentMap::isConsumedExpr(): correctly ignore *parents* thatTed Kremenek2009-05-051-1/+1
| | | | | | are ParenExpr or CastExprs. llvm-svn: 71026
* Another ParentMap bug: only the right side of a comma expression is consumed.Ted Kremenek2009-04-091-2/+2
| | | | llvm-svn: 68680
* Fix bug in ParentMap::isConsumedExpr. A BinaryOperator always "consumes" theTed Kremenek2009-04-081-1/+3
| | | | | | | value of its subexpressions unless it is a comma (in which case it doesn't consume the left subexpression). llvm-svn: 68628
* Fix: <rdar://problem/6740387>. Sending nil to an object that returns a structTed Kremenek2009-04-011-0/+40
| | | | | | | should only be an error if that value is consumed. This fix was largely accomplished by moving 'isConsumedExpr' back to ParentMap. llvm-svn: 68195
* Dead stores checker: Fix <rdar://problem/6506065> by being more selective ↵Ted Kremenek2009-01-201-8/+0
| | | | | | when say that a store is dead even though the computed value is used in the enclosing expression. llvm-svn: 62552
* More #include cleaningDaniel Dunbar2008-08-111-0/+1
| | | | | | | | | | | - Kill unnecessary #includes in .cpp files. This is an automatic sweep so some things removed are actually used, but happen to be included by a previous header. I tried to get rid of the obvious examples and this was the easiest way to trim the #includes in one fell swoop. - We now return to regularly scheduled development. llvm-svn: 54632
* Added ParentMap, a class to represent a lazily constructed mapping from ↵Ted Kremenek2008-06-201-0/+54
child to parents. llvm-svn: 52553
OpenPOWER on IntegriCloud