]> granicus.if.org Git - clang/commitdiff
Objective-C ARC. Adding declarations for Objective-C's
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 6 Aug 2014 20:56:21 +0000 (20:56 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 6 Aug 2014 20:56:21 +0000 (20:56 +0000)
new APIs for literals. nfc. wip. rdar://17554063

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214993 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/NSAPI.h
include/clang/Sema/Sema.h
lib/AST/NSAPI.cpp
lib/Sema/Sema.cpp

index 0b21b0334812723bdd9cefdafa5e56eceaee927e..c64338549f9a1a55eb41c322498582fde34c3d79 100644 (file)
@@ -76,9 +76,10 @@ public:
     NSArr_initWithArray,
     NSArr_initWithObjects,
     NSArr_objectAtIndex,
-    NSMutableArr_replaceObjectAtIndex
+    NSMutableArr_replaceObjectAtIndex,
+    NSArr_initWithObjectsCount
   };
-  static const unsigned NumNSArrayMethods = 9;
+  static const unsigned NumNSArrayMethods = 10;
 
   /// \brief The Objective-C NSArray selectors.
   Selector getNSArraySelector(NSArrayMethodKind MK) const;
@@ -98,9 +99,10 @@ public:
     NSDict_initWithObjectsAndKeys,
     NSDict_initWithObjectsForKeys,
     NSDict_objectForKey,
-    NSMutableDict_setObjectForKey
+    NSMutableDict_setObjectForKey,
+    NSDict_initWithObjectsForKeysCount
   };
-  static const unsigned NumNSDictionaryMethods = 11;
+  static const unsigned NumNSDictionaryMethods = 12;
 
   /// \brief The Objective-C NSDictionary selectors.
   Selector getNSDictionarySelector(NSDictionaryMethodKind MK) const;
index 59a5e5dd4f9a35f2b37b5e4171db61e8adf8ab75..3880cb577365f1ed7ff4e049e7308410ae038bd1 100644 (file)
@@ -672,12 +672,21 @@ public:
 
   /// \brief The declaration of the arrayWithObjects:count: method.
   ObjCMethodDecl *ArrayWithObjectsMethod;
+    
+  /// \brief The declaration of the initWithObjects:count: method.
+  ObjCMethodDecl *InitArrayWithObjectsMethod;
 
   /// \brief The declaration of the Objective-C NSDictionary class.
   ObjCInterfaceDecl *NSDictionaryDecl;
 
   /// \brief The declaration of the dictionaryWithObjects:forKeys:count: method.
   ObjCMethodDecl *DictionaryWithObjectsMethod;
+    
+  /// \brief The declaration of the initWithObjects:forKeys:count: method.
+  ObjCMethodDecl *InitDictionaryWithObjectsMethod;
+    
+  /// \brief The declaration for + (id) alloc method.
+  ObjCMethodDecl *AllocObjectsMethod;
 
   /// \brief id<NSCopying> type.
   QualType QIDNSCopying;
index 986b3b53983dfefcc0b473a66f0f1f5a3beb50bb..c6afc8e38195d4feec4f7c2fa9b9f518b76ebd60 100644 (file)
@@ -119,6 +119,14 @@ Selector NSAPI::getNSArraySelector(NSArrayMethodKind MK) const {
       Sel = Ctx.Selectors.getSelector(2, KeyIdents);
       break;
     }
+    case NSArr_initWithObjectsCount: {
+      IdentifierInfo *KeyIdents[] = {
+        &Ctx.Idents.get("initWithObjects"),
+        &Ctx.Idents.get("count")
+      };
+      Sel = Ctx.Selectors.getSelector(2, KeyIdents);
+      break;
+    }
     }
     return (NSArraySelectors[MK] = Sel);
   }
@@ -204,6 +212,15 @@ Selector NSAPI::getNSDictionarySelector(
       Sel = Ctx.Selectors.getSelector(2, KeyIdents);
       break;
     }
+    case NSDict_initWithObjectsForKeysCount: {
+      IdentifierInfo *KeyIdents[] = {
+        &Ctx.Idents.get("initWithObjects"),
+        &Ctx.Idents.get("forKeys"),
+        &Ctx.Idents.get("count")
+      };
+      Sel = Ctx.Selectors.getSelector(3, KeyIdents);
+      break;
+    }
     }
     return (NSDictionarySelectors[MK] = Sel);
   }
index 46c5cba84df63fe67e024f6de782c592f1338dd1..7fb5eba1c2d124b7b2700ac9a3d8983744f985e6 100644 (file)
@@ -95,7 +95,10 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
     NSNumberDecl(nullptr),
     NSStringDecl(nullptr), StringWithUTF8StringMethod(nullptr),
     NSArrayDecl(nullptr), ArrayWithObjectsMethod(nullptr),
+    InitArrayWithObjectsMethod(nullptr),
     NSDictionaryDecl(nullptr), DictionaryWithObjectsMethod(nullptr),
+    InitDictionaryWithObjectsMethod(nullptr),
+    AllocObjectsMethod(nullptr),
     GlobalNewDeleteDeclared(false),
     TUKind(TUKind),
     NumSFINAEErrors(0),