summaryrefslogtreecommitdiffstats
path: root/lib/ARCMigrate
Commit message (Collapse)AuthorAgeFilesLines
* [arcmt] When fixing the "unassigned init call" ARC error, make sureArgyrios Kyrtzidis2012-03-311-1/+5
| | | | | | | | to do a nil check for the result of the call. rdar://10950973 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153793 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Fix a bug where a property in a class extension, that did not existArgyrios Kyrtzidis2012-03-291-3/+8
| | | | | | | | | in the interface, got its attribute rewritten twice, resulting in 'weakweak' or 'strongstrong'. rdar://11047179 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153621 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify some users of DenseMap::erase.Benjamin Kramer2012-03-241-4/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153389 91177308-0d34-0410-b5e6-96231b3b80d8
* Kill cocoa::deriveNamingConvention and cocoa::followsFundamentalRule. They ↵Jordy Rose2012-03-171-1/+0
| | | | | | | | | are now just simple wrappers around method families, and method decls can cache method family lookups. Also, no one is using them right now. The one difference between ObjCMethodDecl::getMethodFamily and Selector::getMethodFamily is that the former will do some additional sanity checking, and since CoreFoundation types don't look like Objective-C objects, an otherwise interesting method will get a method family of OMF_None. Future clients that use method families should consider how they want to handle CF types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153000 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] The hard-coded list of weak-incompatible classes is no longer necessary.Argyrios Kyrtzidis2012-03-161-38/+0
| | | | | | rdar://10673816 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152879 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] iOS is always safe to use 'weak'. rdar://10950825Argyrios Kyrtzidis2012-03-161-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152878 91177308-0d34-0410-b5e6-96231b3b80d8
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-116-19/+19
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-103-14/+3
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152491 91177308-0d34-0410-b5e6-96231b3b80d8
* Add new code migrator support for migrating existing Objective-C code to useTed Kremenek2012-03-065-18/+375
| | | | | | | | | | | the new Objective-C NSArray/NSDictionary/NSNumber literal syntax. This introduces a new library, libEdit, which provides a new way to support migration of code that improves on the original ARC migrator. We now believe that most of its functionality can be refactored into the existing libraries, and thus this new library may shortly disappear. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152141 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt]Argyrios Kyrtzidis2012-03-053-27/+39
| | | | | | | | | -Make sure we don't change to '__weak' a __block variable used as output. -Make sure we don't apply __weak twice. Fixes rdar://10520757&10521362 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152020 91177308-0d34-0410-b5e6-96231b3b80d8
* Move llvm/ADT/SaveAndRestore.h -> llvm/Support/SaveAndRestore.h.Argyrios Kyrtzidis2012-03-011-1/+1
| | | | | | Needs llvm update. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151829 91177308-0d34-0410-b5e6-96231b3b80d8
* Move "clang/Analysis/Support/SaveAndRestore.h" to "llvm/ADT/SaveAndRestore.h"Argyrios Kyrtzidis2012-02-271-1/+1
| | | | | | | | to make it more widely available. Depends on llvm commit r151564 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151566 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] GC migrator: don't try to remove redundant __strong, it doesArgyrios Kyrtzidis2012-02-251-25/+0
| | | | | | | | more harm than good. Fixes rdar://10522805&10521433 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151424 91177308-0d34-0410-b5e6-96231b3b80d8
* Basic: import IntrusiveRefCntPtr<> into clang namespaceDylan Noblesmith2012-02-201-12/+12
| | | | | | | The class name is long enough without the llvm:: added. Also bring in RefCountedBase and RefCountedBaseVPTR. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150958 91177308-0d34-0410-b5e6-96231b3b80d8
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-054-8/+8
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149799 91177308-0d34-0410-b5e6-96231b3b80d8
* Basic: import OwningPtr<> into clang namespaceDylan Noblesmith2012-02-054-9/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149798 91177308-0d34-0410-b5e6-96231b3b80d8
* Move a method from IdentifierTable.h out of line and remove the SmallString ↵Benjamin Kramer2012-02-042-0/+2
| | | | | | | | include. Fix all the transitive include users. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149783 91177308-0d34-0410-b5e6-96231b3b80d8
* arc migrator: twik previous patch to exclude user providedFariborz Jahanian2012-01-311-1/+1
| | | | | | | explicit type cast. // rdar://10521744 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149437 91177308-0d34-0410-b5e6-96231b3b80d8
* arc migrator: Do not attempt to migrate to bridge casts which Fariborz Jahanian2012-01-311-0/+15
| | | | | | | | cancel out each other. Leave it alone so users can take a look (unmigrated code forces error diagnostic). // rdar://10521744 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149435 91177308-0d34-0410-b5e6-96231b3b80d8
* objc-arc: introduce -no-finalize-removal which in gc mode,Fariborz Jahanian2012-01-262-3/+48
| | | | | | | | | leaves "finalize' behind and in arc mode, does not include it. This allows the migrated source to be compiled in both gc and arc mode. // rdar://10532441 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149079 91177308-0d34-0410-b5e6-96231b3b80d8
* arc migrator: Added an option to the migratorFariborz Jahanian2012-01-262-0/+4
| | | | | | | unused yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149001 91177308-0d34-0410-b5e6-96231b3b80d8
* arc migrator: Provide infrastructure to add optionsFariborz Jahanian2012-01-254-4/+36
| | | | | | | | | | specific to migrator. Use its first option to warn migrating from GC to arc when NSAllocateCollectable/NSReallocateCollectable is used. // rdar://10532541 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148887 91177308-0d34-0410-b5e6-96231b3b80d8
* arg migrator: change all "assign" of object propertiesFariborz Jahanian2012-01-211-9/+11
| | | | | | | to "strong" when migrating from GC. // rdar://10532449 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148607 91177308-0d34-0410-b5e6-96231b3b80d8
* arc migrator: replace "retain" attribute with "strong"Fariborz Jahanian2012-01-201-4/+6
| | | | | | | | which have same semantics in mrr as well as arr. // rdar://10688312 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148559 91177308-0d34-0410-b5e6-96231b3b80d8
* Extract the (InputKind, std::string) pair used to describe inputs toDouglas Gregor2012-01-202-19/+17
| | | | | | | | the front end into its own class, FrontendInputFile, to make it easier to introduce new per-input data. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148546 91177308-0d34-0410-b5e6-96231b3b80d8
* For Lexer's isAt[Start/End]OfMacroExpansion add an out parameter for the macroArgyrios Kyrtzidis2012-01-191-2/+1
| | | | | | | | | start/end location. It is commonly needed after calling the function; with this way we avoid recalculating it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148479 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused variables.Rafael Espindola2011-12-251-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147260 91177308-0d34-0410-b5e6-96231b3b80d8
* Keep track of all declarations of an Objective-C class (both forwardDouglas Gregor2011-12-151-1/+1
| | | | | | | | | | | | declarations and definitions) as ObjCInterfaceDecls within the same redeclaration chain. This new representation matches what we do for C/C++ variables/functions/classes/templates/etc., and makes it possible to answer the query "where are all of the declarations of this class?" git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146679 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Integrate GC __weak into property attributes even when we don't haveArgyrios Kyrtzidis2011-11-284-49/+62
| | | | | | the implementation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145224 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Don't add __weak if there is already a GC __weak and make sure to clearArgyrios Kyrtzidis2011-11-282-7/+14
| | | | | | __weak from a readonly property. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145210 91177308-0d34-0410-b5e6-96231b3b80d8
* Refine placement of LangOptions object in CompilerInvocation by adding a new ↵Ted Kremenek2011-11-181-1/+0
| | | | | | baseclass CompilerInvocationBase with a custom copy constructor. This ensures that whenever the CompilerInvocation object's copy constructor is used we always clone the LangOptions object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144973 91177308-0d34-0410-b5e6-96231b3b80d8
* Make 'LangOptions' in CompilerInvocation a heap-allocated, reference counted ↵Ted Kremenek2011-11-171-11/+12
| | | | | | | | | | | | | | | | | object. I discovered that llvm::RefCountedBase<T> has a bug where the reference count is copied in the copy constructor, which means that there were cases when the CompilerInvocation objects created by ASTUnit were actually leaked. When I fixed that bug locally, it showed that a whole bunch of code assumed that the LangOptions object that was part of CompilerInvocation was still alive. By making it heap-allocated and reference counted, we can keep it around after the CompilerInvocation object goes away. As part of this change, change CompilerInvocation:getLangOptions() to return a pointer, acting as another clue that this object may outlive the CompilerInvocation object. This commit doesn't fix the CompilerInvocation leak itself. That will come when I commit the fix to llvm::RefCountedBase<T> to mainline LLVM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144930 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Take into account that all properties are strong-by-default now and ↵Argyrios Kyrtzidis2011-11-081-42/+7
| | | | | | fix the test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144146 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Now that readonly properties are strong-by-default, do not add ↵Argyrios Kyrtzidis2011-11-081-1/+1
| | | | | | redundant 'strong'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144136 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Now that properties are strong by default, avoid adding redundant ↵Argyrios Kyrtzidis2011-11-081-2/+4
| | | | | | | | '(strong)' property attribute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144078 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] NSViewController does not support weak.Argyrios Kyrtzidis2011-11-081-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144077 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] When we already removed a __weak, don't try to change it to ↵Argyrios Kyrtzidis2011-11-082-2/+6
| | | | | | | | __unsafe_unretained later on, or we will end up with a redundant '__unsafe_unretained'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144059 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Fix handling NSMakeCollectable inside an objc method.Argyrios Kyrtzidis2011-11-071-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143980 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] In GC, handle (assign) @properties.Argyrios Kyrtzidis2011-11-074-130/+269
| | | | | | | | | -Move __strong/__weak added to a property type to the property attribute, e.g. "@property (assign) __weak Foo *prop;" --> "@property (weak) Foo *prop;" -Remove (assign) in a property so that it becomes strong-by-default in ARC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143979 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Map property decls to their GC attributes.Argyrios Kyrtzidis2011-11-073-3/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143978 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] In GC, change '__weak' -> '__unsafe_unretained' when appliedArgyrios Kyrtzidis2011-11-073-5/+33
| | | | | | to objects of classes that don't support ARC weak git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143976 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] In GC, error for __strong/__weak on non-objc pointers.Argyrios Kyrtzidis2011-11-061-0/+18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143887 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] In GC, clear redundant __strong's.Argyrios Kyrtzidis2011-11-062-8/+34
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143886 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Make PropertiesRewriter::getPropertyType return the unqualified type.Argyrios Kyrtzidis2011-11-061-4/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143884 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Collect all the places where GC attributes __strong/__weak occur.Argyrios Kyrtzidis2011-11-066-6/+224
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143883 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Refactor PropertiesRewriter to use MigrationContext.Argyrios Kyrtzidis2011-11-063-4/+35
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143882 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the AST representation of operations on Objective-CJohn McCall2011-11-063-23/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | property references to use a new PseudoObjectExpr expression which pairs a syntactic form of the expression with a set of semantic expressions implementing it. This should significantly reduce the complexity required elsewhere in the compiler to deal with these kinds of expressions (e.g. IR generation's special l-value kind, the static analyzer's Message abstraction), at the lower cost of specifically dealing with the odd AST structure of these expressions. It should also greatly simplify efforts to implement similar language features in the future, most notably Managed C++'s properties and indexed properties. Most of the effort here is in dealing with the various clients of the AST. I've gone ahead and simplified the ObjC rewriter's use of properties; other clients, like IR-gen and the static analyzer, have all the old complexity *and* all the new complexity, at least temporarily. Many thanks to Ted for writing and advising on the necessary changes to the static analyzer. I've xfailed a small diagnostics regression in the static analyzer at Ted's request. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143867 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Fix an assertion hit in rdar://10336125; a bit too complicated to ↵Argyrios Kyrtzidis2011-11-051-0/+3
| | | | | | reduce. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143754 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] In GC, error out when there is a call that returns a pointer toArgyrios Kyrtzidis2011-11-044-0/+43
| | | | | | GC managed non-objc object memory. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143747 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] For GC, cleanup and turn -finalize to -dealloc.Argyrios Kyrtzidis2011-11-045-20/+54
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143701 91177308-0d34-0410-b5e6-96231b3b80d8