Is it possible to give a short motivation in your CL descriptions? On Tue, Oct 28, 2014 at 11:28 AM, Fariborz Jahanian <[email protected]> wrote:
> Author: fjahanian > Date: Tue Oct 28 13:28:16 2014 > New Revision: 220812 > > URL: http://llvm.org/viewvc/llvm-project?rev=220812&view=rev > Log: > Objective-C. revert patch for rdar://17554063. > > > Modified: > cfe/trunk/include/clang/AST/ExprObjC.h > cfe/trunk/include/clang/AST/NSAPI.h > cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > cfe/trunk/include/clang/Sema/Sema.h > cfe/trunk/lib/AST/Expr.cpp > cfe/trunk/lib/AST/NSAPI.cpp > cfe/trunk/lib/CodeGen/CGObjC.cpp > cfe/trunk/lib/CodeGen/CodeGenFunction.h > cfe/trunk/lib/Sema/Sema.cpp > cfe/trunk/lib/Sema/SemaExprObjC.cpp > cfe/trunk/lib/Serialization/ASTReaderStmt.cpp > cfe/trunk/lib/Serialization/ASTWriterStmt.cpp > cfe/trunk/test/CodeGenObjC/Inputs/literal-support.h > cfe/trunk/test/CodeGenObjC/arc-literals.m > cfe/trunk/test/CodeGenObjCXX/Inputs/literal-support.h > cfe/trunk/test/CodeGenObjCXX/literals.mm > cfe/trunk/test/SemaObjC/arc.m > cfe/trunk/test/SemaObjC/objc-literal-comparison.m > cfe/trunk/tools/libclang/IndexBody.cpp > > Modified: cfe/trunk/include/clang/AST/ExprObjC.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/include/clang/AST/ExprObjC.h (original) > +++ cfe/trunk/include/clang/AST/ExprObjC.h Tue Oct 28 13:28:16 2014 > @@ -134,13 +134,9 @@ class ObjCArrayLiteral : public Expr { > unsigned NumElements; > SourceRange Range; > ObjCMethodDecl *ArrayWithObjectsMethod; > - /// \brief in arc mode, this field holds array allocation method > declaration. > - /// In MRR mode, it is null > - ObjCMethodDecl *ArrayAllocMethod; > > ObjCArrayLiteral(ArrayRef<Expr *> Elements, > QualType T, ObjCMethodDecl * Method, > - ObjCMethodDecl *allocMethod, > SourceRange SR); > > explicit ObjCArrayLiteral(EmptyShell Empty, unsigned NumElements) > @@ -150,7 +146,6 @@ public: > static ObjCArrayLiteral *Create(const ASTContext &C, > ArrayRef<Expr *> Elements, > QualType T, ObjCMethodDecl * Method, > - ObjCMethodDecl *allocMethod, > SourceRange SR); > > static ObjCArrayLiteral *CreateEmpty(const ASTContext &C, > @@ -189,10 +184,6 @@ public: > return ArrayWithObjectsMethod; > } > > - ObjCMethodDecl *getArrayAllocMethod() const { > - return ArrayAllocMethod; > - } > - > // Iterators > child_range children() { > return child_range((Stmt **)getElements(), > @@ -265,15 +256,10 @@ class ObjCDictionaryLiteral : public Exp > > SourceRange Range; > ObjCMethodDecl *DictWithObjectsMethod; > - > - /// \brief for arc-specific dictionary literals, this field is used to > store > - /// NSDictionary allocation method declaration. It is null for MRR mode. > - ObjCMethodDecl *DictAllocMethod; > > ObjCDictionaryLiteral(ArrayRef<ObjCDictionaryElement> VK, > bool HasPackExpansions, > QualType T, ObjCMethodDecl *method, > - ObjCMethodDecl *allocMethod, > SourceRange SR); > > explicit ObjCDictionaryLiteral(EmptyShell Empty, unsigned NumElements, > @@ -308,7 +294,6 @@ public: > ArrayRef<ObjCDictionaryElement> VK, > bool HasPackExpansions, > QualType T, ObjCMethodDecl *method, > - ObjCMethodDecl *allocMethod, > SourceRange SR); > > static ObjCDictionaryLiteral *CreateEmpty(const ASTContext &C, > @@ -335,9 +320,6 @@ public: > ObjCMethodDecl *getDictWithObjectsMethod() const > { return DictWithObjectsMethod; } > > - ObjCMethodDecl *getDictAllocMethod() const > - { return DictAllocMethod; } > - > SourceLocation getLocStart() const LLVM_READONLY { return > Range.getBegin(); } > SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); > } > SourceRange getSourceRange() const LLVM_READONLY { return Range; } > > Modified: cfe/trunk/include/clang/AST/NSAPI.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/NSAPI.h?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/include/clang/AST/NSAPI.h (original) > +++ cfe/trunk/include/clang/AST/NSAPI.h Tue Oct 28 13:28:16 2014 > @@ -77,10 +77,9 @@ public: > NSArr_initWithArray, > NSArr_initWithObjects, > NSArr_objectAtIndex, > - NSMutableArr_replaceObjectAtIndex, > - NSArr_initWithObjectsCount > + NSMutableArr_replaceObjectAtIndex > }; > - static const unsigned NumNSArrayMethods = 10; > + static const unsigned NumNSArrayMethods = 9; > > /// \brief The Objective-C NSArray selectors. > Selector getNSArraySelector(NSArrayMethodKind MK) const; > > Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) > +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Oct 28 > 13:28:16 2014 > @@ -2046,8 +2046,6 @@ def err_undeclared_nsarray : Error< > def err_undeclared_nsdictionary : Error< > "NSDictionary must be available to use Objective-C dictionary " > "literals">; > -def err_undeclared_alloc : Error< > - "alloc must be available to use Objective-C literals">; > def err_undeclared_boxing_method : Error< > "declaration of %0 is missing in %1 class">; > def err_objc_literal_method_sig : Error< > > Modified: cfe/trunk/include/clang/Sema/Sema.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/include/clang/Sema/Sema.h (original) > +++ cfe/trunk/include/clang/Sema/Sema.h Tue Oct 28 13:28:16 2014 > @@ -681,24 +681,12 @@ 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 used in [NSArray > alloc] > - ObjCMethodDecl *ArrayAllocObjectsMethod; > - > - /// \brief The declaration for + (id) alloc method used in > [NSDictionary alloc] > - ObjCMethodDecl *DictAllocObjectsMethod; > > /// \brief id<NSCopying> type. > QualType QIDNSCopying; > > Modified: cfe/trunk/lib/AST/Expr.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/lib/AST/Expr.cpp (original) > +++ cfe/trunk/lib/AST/Expr.cpp Tue Oct 28 13:28:16 2014 > @@ -4082,12 +4082,10 @@ Stmt::child_range ObjCMessageExpr::child > > ObjCArrayLiteral::ObjCArrayLiteral(ArrayRef<Expr *> Elements, > QualType T, ObjCMethodDecl *Method, > - ObjCMethodDecl *AllocMethod, > SourceRange SR) > : Expr(ObjCArrayLiteralClass, T, VK_RValue, OK_Ordinary, > false, false, false, false), > - NumElements(Elements.size()), Range(SR), > ArrayWithObjectsMethod(Method), > - ArrayAllocMethod(AllocMethod) > + NumElements(Elements.size()), Range(SR), > ArrayWithObjectsMethod(Method) > { > Expr **SaveElements = getElements(); > for (unsigned I = 0, N = Elements.size(); I != N; ++I) { > @@ -4105,11 +4103,10 @@ ObjCArrayLiteral::ObjCArrayLiteral(Array > ObjCArrayLiteral *ObjCArrayLiteral::Create(const ASTContext &C, > ArrayRef<Expr *> Elements, > QualType T, ObjCMethodDecl * > Method, > - ObjCMethodDecl *allocMethod, > SourceRange SR) { > void *Mem = C.Allocate(sizeof(ObjCArrayLiteral) > + Elements.size() * sizeof(Expr *)); > - return new (Mem) ObjCArrayLiteral(Elements, T, Method, allocMethod, SR); > + return new (Mem) ObjCArrayLiteral(Elements, T, Method, SR); > } > > ObjCArrayLiteral *ObjCArrayLiteral::CreateEmpty(const ASTContext &C, > @@ -4124,13 +4121,11 @@ ObjCDictionaryLiteral::ObjCDictionaryLit > > ArrayRef<ObjCDictionaryElement> VK, > bool HasPackExpansions, > QualType T, ObjCMethodDecl > *method, > - ObjCMethodDecl *allocMethod, > SourceRange SR) > : Expr(ObjCDictionaryLiteralClass, T, VK_RValue, OK_Ordinary, false, > false, > false, false), > NumElements(VK.size()), HasPackExpansions(HasPackExpansions), > Range(SR), > - DictWithObjectsMethod(method), > - DictAllocMethod(allocMethod) > + DictWithObjectsMethod(method) > { > KeyValuePair *KeyValues = getKeyValues(); > ExpansionData *Expansions = getExpansionData(); > @@ -4163,7 +4158,6 @@ ObjCDictionaryLiteral::Create(const ASTC > ArrayRef<ObjCDictionaryElement> VK, > bool HasPackExpansions, > QualType T, ObjCMethodDecl *method, > - ObjCMethodDecl *allocMethod, > SourceRange SR) { > unsigned ExpansionsSize = 0; > if (HasPackExpansions) > @@ -4171,8 +4165,7 @@ ObjCDictionaryLiteral::Create(const ASTC > > void *Mem = C.Allocate(sizeof(ObjCDictionaryLiteral) + > sizeof(KeyValuePair) * VK.size() + > ExpansionsSize); > - return new (Mem) ObjCDictionaryLiteral(VK, HasPackExpansions, T, > - method, allocMethod, SR); > + return new (Mem) ObjCDictionaryLiteral(VK, HasPackExpansions, T, > method, SR); > } > > ObjCDictionaryLiteral * > > Modified: cfe/trunk/lib/AST/NSAPI.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/NSAPI.cpp?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/lib/AST/NSAPI.cpp (original) > +++ cfe/trunk/lib/AST/NSAPI.cpp Tue Oct 28 13:28:16 2014 > @@ -124,14 +124,6 @@ Selector NSAPI::getNSArraySelector(NSArr > 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); > } > @@ -217,15 +209,6 @@ 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); > } > > Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/lib/CodeGen/CGObjC.cpp (original) > +++ cfe/trunk/lib/CodeGen/CGObjC.cpp Tue Oct 28 13:28:16 2014 > @@ -88,8 +88,7 @@ CodeGenFunction::EmitObjCBoxedExpr(const > } > > llvm::Value *CodeGenFunction::EmitObjCCollectionLiteral(const Expr *E, > - const ObjCMethodDecl > *MethodWithObjects, > - const ObjCMethodDecl *AllocMethod) { > + const ObjCMethodDecl > *MethodWithObjects) { > ASTContext &Context = CGM.getContext(); > const ObjCDictionaryLiteral *DLE = nullptr; > const ObjCArrayLiteral *ALE = dyn_cast<ObjCArrayLiteral>(E); > @@ -185,15 +184,6 @@ llvm::Value *CodeGenFunction::EmitObjCCo > = InterfacePointerType->getObjectType()->getInterface(); > CGObjCRuntime &Runtime = CGM.getObjCRuntime(); > llvm::Value *Receiver = Runtime.GetClass(*this, Class); > - if (AllocMethod) { > - // Generate the "alloc" message send. > - CallArgList Args; > - Selector AllocMethodSel = AllocMethod->getSelector(); > - RValue result = Runtime.GenerateMessageSend( > - *this, ReturnValueSlot(), AllocMethod->getReturnType(), > AllocMethodSel, > - Receiver, Args, Class, AllocMethod); > - Receiver = result.getScalarVal(); > - } > > // Generate the message send. > RValue result = Runtime.GenerateMessageSend( > @@ -213,14 +203,12 @@ llvm::Value *CodeGenFunction::EmitObjCCo > } > > llvm::Value *CodeGenFunction::EmitObjCArrayLiteral(const ObjCArrayLiteral > *E) { > - return EmitObjCCollectionLiteral(E, E->getArrayWithObjectsMethod(), > - E->getArrayAllocMethod()); > + return EmitObjCCollectionLiteral(E, E->getArrayWithObjectsMethod()); > } > > llvm::Value *CodeGenFunction::EmitObjCDictionaryLiteral( > const ObjCDictionaryLiteral > *E) { > - return EmitObjCCollectionLiteral(E, E->getDictWithObjectsMethod(), > - E->getDictAllocMethod()); > + return EmitObjCCollectionLiteral(E, E->getDictWithObjectsMethod()); > } > > /// Emit a selector. > > Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original) > +++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Tue Oct 28 13:28:16 2014 > @@ -2392,8 +2392,7 @@ public: > llvm::Value *EmitObjCArrayLiteral(const ObjCArrayLiteral *E); > llvm::Value *EmitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E); > llvm::Value *EmitObjCCollectionLiteral(const Expr *E, > - const ObjCMethodDecl *MethodWithObjects, > - const ObjCMethodDecl *AllocMethod); > + const ObjCMethodDecl *MethodWithObjects); > llvm::Value *EmitObjCSelectorExpr(const ObjCSelectorExpr *E); > RValue EmitObjCMessageExpr(const ObjCMessageExpr *E, > ReturnValueSlot Return = ReturnValueSlot()); > > Modified: cfe/trunk/lib/Sema/Sema.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/lib/Sema/Sema.cpp (original) > +++ cfe/trunk/lib/Sema/Sema.cpp Tue Oct 28 13:28:16 2014 > @@ -94,11 +94,7 @@ Sema::Sema(Preprocessor &pp, ASTContext > NSNumberDecl(nullptr), > NSStringDecl(nullptr), StringWithUTF8StringMethod(nullptr), > NSArrayDecl(nullptr), ArrayWithObjectsMethod(nullptr), > - InitArrayWithObjectsMethod(nullptr), > NSDictionaryDecl(nullptr), DictionaryWithObjectsMethod(nullptr), > - InitDictionaryWithObjectsMethod(nullptr), > - ArrayAllocObjectsMethod(nullptr), > - DictAllocObjectsMethod(nullptr), > MSAsmLabelNameCounter(0), > GlobalNewDeleteDeclared(false), > TUKind(TUKind), > > Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original) > +++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Tue Oct 28 13:28:16 2014 > @@ -597,31 +597,6 @@ ExprResult Sema::BuildObjCBoxedExpr(Sour > return MaybeBindToTemporary(BoxedExpr); > } > > -static ObjCMethodDecl *FindAllocMethod(Sema &S, ObjCInterfaceDecl > *NSClass) { > - ObjCMethodDecl *Method = nullptr; > - ASTContext &Context = S.Context; > - > - // Find +[NSClass alloc] method. > - IdentifierInfo *II = &Context.Idents.get("alloc"); > - Selector AllocSel = Context.Selectors.getSelector(0, &II); > - Method = NSClass->lookupClassMethod(AllocSel); > - if (!Method && S.getLangOpts().DebuggerObjCLiteral) { > - Method = ObjCMethodDecl::Create(Context, > - SourceLocation(), SourceLocation(), AllocSel, > - Context.getObjCIdType(), > - nullptr /*TypeSourceInfo */, > - Context.getTranslationUnitDecl(), > - false /*Instance*/, false/*isVariadic*/, > - /*isPropertyAccessor=*/false, > - /*isImplicitlyDeclared=*/true, /*isDefined=*/false, > - ObjCMethodDecl::Required, > - false); > - SmallVector<ParmVarDecl *, 1> Params; > - Method->setMethodParams(Context, Params, None); > - } > - return Method; > -} > - > /// Build an ObjC subscript pseudo-object expression, given that > /// that's supported by the runtime. > ExprResult Sema::BuildObjCSubscriptExpression(SourceLocation RB, Expr > *BaseExpr, > @@ -655,7 +630,6 @@ ExprResult Sema::BuildObjCSubscriptExpre > } > > ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg > Elements) { > - bool Arc = getLangOpts().ObjCAutoRefCount; > // Look up the NSArray class, if we haven't done so already. > if (!NSArrayDecl) { > NamedDecl *IF = LookupSingleName(TUScope, > @@ -675,29 +649,18 @@ ExprResult Sema::BuildObjCArrayLiteral(S > return ExprError(); > } > } > - if (Arc && !ArrayAllocObjectsMethod) { > - // Find +[NSArray alloc] method. > - ArrayAllocObjectsMethod = FindAllocMethod(*this, NSArrayDecl); > - if (!ArrayAllocObjectsMethod) { > - Diag(SR.getBegin(), diag::err_undeclared_alloc); > - return ExprError(); > - } > - } > + > // Find the arrayWithObjects:count: method, if we haven't done so > already. > QualType IdT = Context.getObjCIdType(); > if (!ArrayWithObjectsMethod) { > Selector > - Sel = NSAPIObj->getNSArraySelector( > - Arc? NSAPI::NSArr_initWithObjectsCount : > NSAPI::NSArr_arrayWithObjectsCount); > - ObjCMethodDecl *Method = > - Arc? NSArrayDecl->lookupInstanceMethod(Sel) > - : NSArrayDecl->lookupClassMethod(Sel); > + Sel = > NSAPIObj->getNSArraySelector(NSAPI::NSArr_arrayWithObjectsCount); > + ObjCMethodDecl *Method = NSArrayDecl->lookupClassMethod(Sel); > if (!Method && getLangOpts().DebuggerObjCLiteral) { > TypeSourceInfo *ReturnTInfo = nullptr; > Method = ObjCMethodDecl::Create( > Context, SourceLocation(), SourceLocation(), Sel, IdT, > ReturnTInfo, > - Context.getTranslationUnitDecl(), > - Arc /*Instance for Arc, Class for MRR*/, > + Context.getTranslationUnitDecl(), false /*Instance*/, > false /*isVariadic*/, > /*isPropertyAccessor=*/false, > /*isImplicitlyDeclared=*/true, /*isDefined=*/false, > @@ -777,14 +740,12 @@ ExprResult Sema::BuildObjCArrayLiteral(S > > return MaybeBindToTemporary( > ObjCArrayLiteral::Create(Context, Elements, Ty, > - ArrayWithObjectsMethod, > - ArrayAllocObjectsMethod, SR)); > + ArrayWithObjectsMethod, SR)); > } > > ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, > ObjCDictionaryElement > *Elements, > unsigned NumElements) { > - bool Arc = getLangOpts().ObjCAutoRefCount; > // Look up the NSDictionary class, if we haven't done so already. > if (!NSDictionaryDecl) { > NamedDecl *IF = LookupSingleName(TUScope, > @@ -804,32 +765,20 @@ ExprResult Sema::BuildObjCDictionaryLite > } > } > > - if (Arc && !DictAllocObjectsMethod) { > - // Find +[NSDictionary alloc] method. > - DictAllocObjectsMethod = FindAllocMethod(*this, NSDictionaryDecl); > - if (!DictAllocObjectsMethod) { > - Diag(SR.getBegin(), diag::err_undeclared_alloc); > - return ExprError(); > - } > - } > - > - // Find the dictionaryWithObjects:forKeys:count: or > initWithObjects:forKeys:count: > - // (for arc) method, if we haven't done so already. > + // Find the dictionaryWithObjects:forKeys:count: method, if we haven't > done > + // so already. > QualType IdT = Context.getObjCIdType(); > if (!DictionaryWithObjectsMethod) { > - Selector Sel = > - NSAPIObj->getNSDictionarySelector(Arc? > NSAPI::NSDict_initWithObjectsForKeysCount > - : > NSAPI::NSDict_dictionaryWithObjectsForKeysCount); > - ObjCMethodDecl *Method = > - Arc ? NSDictionaryDecl->lookupInstanceMethod(Sel) > - : NSDictionaryDecl->lookupClassMethod(Sel); > + Selector Sel = NSAPIObj->getNSDictionarySelector( > + > NSAPI::NSDict_dictionaryWithObjectsForKeysCount); > + ObjCMethodDecl *Method = NSDictionaryDecl->lookupClassMethod(Sel); > if (!Method && getLangOpts().DebuggerObjCLiteral) { > Method = ObjCMethodDecl::Create(Context, > SourceLocation(), SourceLocation(), Sel, > IdT, > nullptr /*TypeSourceInfo */, > Context.getTranslationUnitDecl(), > - Arc /*Instance for Arc, Class for MRR*/, > false/*isVariadic*/, > + false /*Instance*/, false/*isVariadic*/, > /*isPropertyAccessor=*/false, > /*isImplicitlyDeclared=*/true, > /*isDefined=*/false, > ObjCMethodDecl::Required, > @@ -976,7 +925,7 @@ ExprResult Sema::BuildObjCDictionaryLite > > Context.getObjCInterfaceType(NSDictionaryDecl)); > return MaybeBindToTemporary(ObjCDictionaryLiteral::Create( > Context, makeArrayRef(Elements, NumElements), HasPackExpansions, Ty, > - DictionaryWithObjectsMethod, DictAllocObjectsMethod, SR)); > + DictionaryWithObjectsMethod, SR)); > } > > ExprResult Sema::BuildObjCEncodeExpression(SourceLocation AtLoc, > > Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original) > +++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Tue Oct 28 13:28:16 2014 > @@ -936,7 +936,6 @@ void ASTStmtReader::VisitObjCArrayLitera > for (unsigned I = 0, N = NumElements; I != N; ++I) > Elements[I] = Reader.ReadSubExpr(); > E->ArrayWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx); > - E->ArrayAllocMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx); > E->Range = ReadSourceRange(Record, Idx); > } > > @@ -957,7 +956,6 @@ void ASTStmtReader::VisitObjCDictionaryL > } > } > E->DictWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx); > - E->DictAllocMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx); > E->Range = ReadSourceRange(Record, Idx); > } > > > Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original) > +++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Tue Oct 28 13:28:16 2014 > @@ -879,7 +879,6 @@ void ASTStmtWriter::VisitObjCArrayLitera > for (unsigned i = 0; i < E->getNumElements(); i++) > Writer.AddStmt(E->getElement(i)); > Writer.AddDeclRef(E->getArrayWithObjectsMethod(), Record); > - Writer.AddDeclRef(E->getArrayAllocMethod(), Record); > Writer.AddSourceRange(E->getSourceRange(), Record); > Code = serialization::EXPR_OBJC_ARRAY_LITERAL; > } > @@ -902,7 +901,6 @@ void ASTStmtWriter::VisitObjCDictionaryL > } > > Writer.AddDeclRef(E->getDictWithObjectsMethod(), Record); > - Writer.AddDeclRef(E->getDictAllocMethod(), Record); > Writer.AddSourceRange(E->getSourceRange(), Record); > Code = serialization::EXPR_OBJC_DICTIONARY_LITERAL; > } > > Modified: cfe/trunk/test/CodeGenObjC/Inputs/literal-support.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/Inputs/literal-support.h?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/test/CodeGenObjC/Inputs/literal-support.h (original) > +++ cfe/trunk/test/CodeGenObjC/Inputs/literal-support.h Tue Oct 28 > 13:28:16 2014 > @@ -3,10 +3,6 @@ > > typedef unsigned char BOOL; > > -@interface NSObject > -+ (id)alloc; > -@end > - > @interface NSNumber @end > > @interface NSNumber (NSNumberCreation) > @@ -25,17 +21,15 @@ typedef unsigned char BOOL; > + (NSNumber *)numberWithBool:(BOOL)value; > @end > > -@interface NSArray : NSObject > +@interface NSArray > @end > > @interface NSArray (NSArrayCreation) > + (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt; > -- (id)initWithObjects:(const id [])objects count:(unsigned long)cnt; > @end > > -@interface NSDictionary : NSObject > +@interface NSDictionary > + (id)dictionaryWithObjects:(const id [])objects forKeys:(const id > [])keys count:(unsigned long)cnt; > -- (instancetype)initWithObjects:(const id [])objects forKeys:(const id > [])keys count:(unsigned long)cnt; > @end > > #endif // OBJC_LITERAL_SUPPORT_H > > Modified: cfe/trunk/test/CodeGenObjC/arc-literals.m > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-literals.m?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/test/CodeGenObjC/arc-literals.m (original) > +++ cfe/trunk/test/CodeGenObjC/arc-literals.m Tue Oct 28 13:28:16 2014 > @@ -8,8 +8,8 @@ > // CHECK: c"numberWithUnsignedInt:\00" > // CHECK: c"numberWithUnsignedLongLong:\00" > // CHECK: c"numberWithChar:\00" > -// CHECK: c"initWithObjects:count:\00" > -// CHECK: c"initWithObjects:forKeys:count:\00" > +// CHECK: c"arrayWithObjects:count:\00" > +// CHECK: c"dictionaryWithObjects:forKeys:count:\00" > // CHECK: c"prop\00" > > // CHECK-LABEL: define void @test_numeric() > @@ -53,12 +53,10 @@ void test_array(id a, id b) { > // CHECK-NEXT: [[T0:%.*]] = load [[CLASS_T:%.*]]** @"\01L_OBJC_CLASSLIST > // CHECK-NEXT: [[SEL:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES > // CHECK-NEXT: [[T1:%.*]] = bitcast [[CLASS_T]]* [[T0]] to i8* > - > - // CHECK-NEXT: [[ALLOC:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* > @objc_msgSend to i8* (i8*, i8*)*)(i8* [[T1]], i8* [[SEL]]) > - // CHECK-NEXT: [[T9:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES > - // CHECK-NEXT: [[T10:%.*]] = bitcast [2 x i8*]* [[OBJECTS]] to i8** > - // CHECK-NEXT: [[ARRAYINIT:%.*]] = call i8* bitcast (i8* (i8*, i8*, > ...)* @objc_msgSend to i8* (i8*, i8*, i8**, i64)*)(i8* [[ALLOC]], i8* > [[T9]], i8** [[T10]], i64 2) > - // CHECK-NEXT: call void (...)* @clang.arc.use(i8* [[V0]], i8* [[V1]]) > + // CHECK-NEXT: [[T2:%.*]] = bitcast [2 x i8*]* [[OBJECTS]] to i8** > + // CHECK-NEXT: [[T3:%.*]] = call i8* bitcast > ({{.*@objc_msgSend.*}})(i8* [[T1]], i8* [[SEL]], i8** [[T2]], i64 2) > + // CHECK-NEXT: [[T4:%.*]] = call i8* > @objc_retainAutoreleasedReturnValue(i8* [[T3]]) > + // CHECK: call void (...)* @clang.arc.use(i8* [[V0]], i8* [[V1]]) > id arr = @[a, b]; > > // CHECK: call void @objc_release > @@ -98,12 +96,10 @@ void test_dictionary(id k1, id o1, id k2 > // CHECK-NEXT: [[T0:%.*]] = load [[CLASS_T:%.*]]** @"\01L_OBJC_CLASSLIST > // CHECK-NEXT: [[SEL:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES > // CHECK-NEXT: [[T1:%.*]] = bitcast [[CLASS_T]]* [[T0]] to i8* > - > - // CHECK-NEXT: [[ALLOC:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* > @objc_msgSend to i8* (i8*, i8*)*)(i8* [[T1]], i8* [[SEL]]) > - // CHECK-NEXT: [[T15:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES > - // CHECK-NEXT: [[T16:%.*]] = bitcast [2 x i8*]* [[OBJECTS]] to i8** > - // CHECK-NEXT: [[T17:%.*]] = bitcast [2 x i8*]* [[KEYS]] to i8** > - // CHECK-NEXT: [[INIT:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* > @objc_msgSend to i8* (i8*, i8*, i8**, i8**, i64)*)(i8* [[ALLOC]], i8* > [[T15]], i8** [[T16]], i8** [[T17]], i64 2) > + // CHECK-NEXT: [[T2:%.*]] = bitcast [2 x i8*]* [[OBJECTS]] to i8** > + // CHECK-NEXT: [[T3:%.*]] = bitcast [2 x i8*]* [[KEYS]] to i8** > + // CHECK-NEXT: [[T4:%.*]] = call i8* bitcast > ({{.*@objc_msgSend.*}})(i8* [[T1]], i8* [[SEL]], i8** [[T2]], i8** [[T3]], > i64 2) > + // CHECK-NEXT: [[T5:%.*]] = call i8* > @objc_retainAutoreleasedReturnValue(i8* [[T4]]) > // CHECK-NEXT: call void (...)* @clang.arc.use(i8* [[V0]], i8* [[V1]], > i8* [[V2]], i8* [[V3]]) > > id dict = @{ k1 : o1, k2 : o2 }; > @@ -142,15 +138,13 @@ void test_property(B *b) { > // Store to array. > // CHECK-NEXT: store i8* [[V1]], i8** [[T0]] > > - // Invoke initWithObjects:count: > + // Invoke arrayWithObjects:count: > // CHECK-NEXT: [[T0:%.*]] = load [[CLASS_T]]** @"\01L_OBJC_CLASSLIST > // CHECK-NEXT: [[SEL:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES > // CHECK-NEXT: [[T1:%.*]] = bitcast [[CLASS_T]]* [[T0]] to i8* > - > - // CHECK-NEXT: [[ALLOC:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* > @objc_msgSend to i8* (i8*, i8*)*)(i8* [[T1]], i8* [[SEL]]) > - // CHECK-NEXT: [[T9:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES > - // CHECK-NEXT: [[T10:%.*]] = bitcast [1 x i8*]* [[OBJECTS]] to i8** > - // CHECK-NEXT: [[INIT:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* > @objc_msgSend to i8* (i8*, i8*, i8**, i64)*)(i8* [[ALLOC]], i8* [[T9]], > i8** [[T10]], i64 1) > + // CHECK-NEXT: [[T2:%.*]] = bitcast [1 x i8*]* [[OBJECTS]] to i8** > + // CHECK-NEXT: [[T3:%.*]] = call i8* bitcast ({{.*}} @objc_msgSend to > {{.*}}(i8* [[T1]], i8* [[SEL]], i8** [[T2]], i64 1) > + // CHECK-NEXT: call i8* @objc_retainAutoreleasedReturnValue(i8* [[T3]]) > // CHECK-NEXT: call void (...)* @clang.arc.use(i8* [[V1]]) > // CHECK-NEXT: bitcast > // CHECK-NEXT: bitcast > > Modified: cfe/trunk/test/CodeGenObjCXX/Inputs/literal-support.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/Inputs/literal-support.h?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/test/CodeGenObjCXX/Inputs/literal-support.h (original) > +++ cfe/trunk/test/CodeGenObjCXX/Inputs/literal-support.h Tue Oct 28 > 13:28:16 2014 > @@ -3,10 +3,6 @@ > > typedef unsigned char BOOL; > > -@interface NSObject > -+ (id)alloc; > -@end > - > @interface NSNumber @end > > @interface NSNumber (NSNumberCreation) > @@ -25,15 +21,14 @@ typedef unsigned char BOOL; > + (NSNumber *)numberWithBool:(BOOL)value; > @end > > -@interface NSArray : NSObject > +@interface NSArray > @end > > @interface NSArray (NSArrayCreation) > + (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt; > -- (id)initWithObjects:(const id [])objects count:(unsigned long)cnt; > @end > > -@interface NSDictionary : NSObject > +@interface NSDictionary > + (id)dictionaryWithObjects:(const id [])objects forKeys:(const id > [])keys count:(unsigned long)cnt; > @end > > > Modified: cfe/trunk/test/CodeGenObjCXX/literals.mm > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/literals.mm?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/test/CodeGenObjCXX/literals.mm (original) > +++ cfe/trunk/test/CodeGenObjCXX/literals.mm Tue Oct 28 13:28:16 2014 > @@ -33,15 +33,8 @@ void test_array() { > // CHECK: store i8* [[RET1]], i8** [[ELEMENT1]] > > // Build the array > - // CHECK: [[T4:%.*]] = load [[CLASS:%.*]]** > @"\01L_OBJC_CLASSLIST_REFERENCES_$_" > - // CHECK-NEXT: [[T5:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ > - // CHECK-NEXT: [[T6:%.*]] = bitcast [[CLASS]]* [[T4]] to i8* > - // CHECK-NEXT: [[ALLOC:%.*]] = {{invoke.*@objc_msgSend}} > - > - // CHECK: [[T7:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ > - // CHECK-NEXT: [[T8:%.*]] = bitcast [2 x i8*]* [[OBJECTS]] to i8** > - // CHECK-NEXT: [[INIT:%.*]] = {{invoke.*@objc_msgSend}} > - > + // CHECK: {{invoke.*@objc_msgSend}} > + // CHECK: call i8* @objc_retainAutoreleasedReturnValue > id arr = @[ X(), Y() ]; > > // Destroy temporaries > @@ -88,7 +81,7 @@ void test_array_instantiation() { > > // Build the array > // CHECK: {{invoke.*@objc_msgSend}} > - > + // CHECK: call i8* @objc_retainAutoreleasedReturnValue > id arr = @[ X(), Y() ]; > > // Destroy temporaries > > Modified: cfe/trunk/test/SemaObjC/arc.m > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc.m?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/test/SemaObjC/arc.m (original) > +++ cfe/trunk/test/SemaObjC/arc.m Tue Oct 28 13:28:16 2014 > @@ -5,14 +5,9 @@ typedef const void * CFTypeRef; > CFTypeRef CFBridgingRetain(id X); > id CFBridgingRelease(CFTypeRef); > @protocol NSCopying @end > -@interface NSObject > -+ (id)alloc; > -@end > - > -@interface NSDictionary : NSObject > +@interface NSDictionary > + (id)dictionaryWithObjects:(const id [])objects forKeys:(const id > <NSCopying> [])keys count:(NSUInteger)cnt; > - (void)setObject:(id)object forKeyedSubscript:(id)key; > -- (instancetype)initWithObjects:(const id [])objects forKeys:(const id > <NSCopying> [])keys count:(NSUInteger)cnt; > @end > @class NSFastEnumerationState; > @protocol NSFastEnumeration > @@ -21,9 +16,8 @@ id CFBridgingRelease(CFTypeRef); > @interface NSNumber > + (NSNumber *)numberWithInt:(int)value; > @end > -@interface NSArray : NSObject <NSFastEnumeration> > +@interface NSArray <NSFastEnumeration> > + (id)arrayWithObjects:(const id [])objects count:(NSUInteger)cnt; > -- (id)initWithObjects:(const id [])objects count:(NSUInteger)cnt; > @end > > void test0(void (*fn)(int), int val) { > @@ -748,16 +742,16 @@ void _NSCalcBeze(NSColor* color, NSColor > void rdar12569201(id key, id value) { > // Declarations. > __weak id x = @"foo"; // no-warning > - __weak id y = @{ key : value }; // expected-warning {{assigning > retained object to weak variable; object will be released after assignment}} > - __weak id z = @[ value ]; // expected-warning {{assigning retained > object to weak variable; object will be released after assignment}} > + __weak id y = @{ key : value }; // expected-warning {{assigning > dictionary literal to a weak variable; object will be released after > assignment}} > + __weak id z = @[ value ]; // expected-warning {{assigning array > literal to a weak variable; object will be released after assignment}} > __weak id b = ^() {}; // expected-warning {{assigning block literal > to a weak variable; object will be released after assignment}} > __weak id n = @42; // expected-warning {{assigning numeric literal to > a weak variable; object will be released after assignment}} > __weak id e = @(42); // expected-warning {{assigning numeric literal > to a weak variable; object will be released after assignment}} > __weak id m = @(41 + 1); // expected-warning {{assigning boxed > expression to a weak variable; object will be released after assignment}} > > // Assignments. > - y = @{ key : value }; // expected-warning {{assigning retained object > to weak variable; object will be released after assignment}} > - z = @[ value ]; // expected-warning {{assigning retained object to > weak variable; object will be released after assignment}} > + y = @{ key : value }; // expected-warning {{assigning dictionary > literal to a weak variable; object will be released after assignment}} > + z = @[ value ]; // expected-warning {{assigning array literal to a > weak variable; object will be released after assignment}} > b = ^() {}; // expected-warning {{assigning block literal to a weak > variable; object will be released after assignment}} > n = @42; // expected-warning {{assigning numeric literal to a weak > variable; object will be released after assignment}} > e = @(42); // expected-warning {{assigning numeric literal to a weak > variable; object will be released after assignment}} > > Modified: cfe/trunk/test/SemaObjC/objc-literal-comparison.m > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/objc-literal-comparison.m?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/test/SemaObjC/objc-literal-comparison.m (original) > +++ cfe/trunk/test/SemaObjC/objc-literal-comparison.m Tue Oct 28 13:28:16 > 2014 > @@ -10,15 +10,12 @@ > > typedef signed char BOOL; > > -@protocol NSCopying @end > - > @interface BaseObject > + (instancetype)new; > @end > > @interface NSObject : BaseObject > - (BOOL)isEqual:(id)other; > -+ (id)alloc; > @end > > @interface NSNumber : NSObject > @@ -29,12 +26,10 @@ typedef signed char BOOL; > > @interface NSArray : NSObject > + (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt; > -- (id)initWithObjects:(const id [])objects count:(unsigned long)cnt; > @end > > @interface NSDictionary : NSObject > + (id)dictionaryWithObjects:(const id [])objects forKeys:(const id > [])keys count:(unsigned long)cnt; > -- (instancetype)initWithObjects:(const id [])objects forKeys:(const id > <NSCopying> [])keys count:(unsigned long)cnt; > @end > > @interface NSString : NSObject > > Modified: cfe/trunk/tools/libclang/IndexBody.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexBody.cpp?rev=220812&r1=220811&r2=220812&view=diff > > ============================================================================== > --- cfe/trunk/tools/libclang/IndexBody.cpp (original) > +++ cfe/trunk/tools/libclang/IndexBody.cpp Tue Oct 28 13:28:16 2014 > @@ -109,9 +109,6 @@ public: > if (ObjCMethodDecl *MD = E->getDictWithObjectsMethod()) > IndexCtx.handleReference(MD, E->getLocStart(), > Parent, ParentDC, E, > CXIdxEntityRef_Implicit); > - if (ObjCMethodDecl *MD = E->getDictAllocMethod()) > - IndexCtx.handleReference(MD, E->getLocStart(), > - Parent, ParentDC, E, > CXIdxEntityRef_Implicit); > return true; > } > > @@ -119,9 +116,6 @@ public: > if (ObjCMethodDecl *MD = E->getArrayWithObjectsMethod()) > IndexCtx.handleReference(MD, E->getLocStart(), > Parent, ParentDC, E, > CXIdxEntityRef_Implicit); > - if (ObjCMethodDecl *MD = E->getArrayAllocMethod()) > - IndexCtx.handleReference(MD, E->getLocStart(), > - Parent, ParentDC, E, > CXIdxEntityRef_Implicit); > return true; > } > > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
