diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/Expr.cpp | 15 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjC.cpp | 9 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 3 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReaderStmt.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriterStmt.cpp | 2 |
6 files changed, 25 insertions, 10 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 1e52e535329..97f1b882619 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -4041,10 +4041,12 @@ Stmt::child_range ObjCMessageExpr::children() { 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) + NumElements(Elements.size()), Range(SR), ArrayWithObjectsMethod(Method), + ArrayAllocMethod(AllocMethod) { Expr **SaveElements = getElements(); for (unsigned I = 0, N = Elements.size(); I != N; ++I) { @@ -4062,10 +4064,11 @@ ObjCArrayLiteral::ObjCArrayLiteral(ArrayRef<Expr *> Elements, 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, SR); + return new (Mem) ObjCArrayLiteral(Elements, T, Method, allocMethod, SR); } ObjCArrayLiteral *ObjCArrayLiteral::CreateEmpty(const ASTContext &C, @@ -4080,11 +4083,13 @@ ObjCDictionaryLiteral::ObjCDictionaryLiteral( 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) + DictWithObjectsMethod(method), + DictAllocMethod(allocMethod) { KeyValuePair *KeyValues = getKeyValues(); ExpansionData *Expansions = getExpansionData(); @@ -4117,6 +4122,7 @@ ObjCDictionaryLiteral::Create(const ASTContext &C, ArrayRef<ObjCDictionaryElement> VK, bool HasPackExpansions, QualType T, ObjCMethodDecl *method, + ObjCMethodDecl *allocMethod, SourceRange SR) { unsigned ExpansionsSize = 0; if (HasPackExpansions) @@ -4124,7 +4130,8 @@ ObjCDictionaryLiteral::Create(const ASTContext &C, void *Mem = C.Allocate(sizeof(ObjCDictionaryLiteral) + sizeof(KeyValuePair) * VK.size() + ExpansionsSize); - return new (Mem) ObjCDictionaryLiteral(VK, HasPackExpansions, T, method, SR); + return new (Mem) ObjCDictionaryLiteral(VK, HasPackExpansions, T, + method, allocMethod, SR); } ObjCDictionaryLiteral * diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 8ca80808e00..a67e900a179 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -88,7 +88,8 @@ CodeGenFunction::EmitObjCBoxedExpr(const ObjCBoxedExpr *E) { } llvm::Value *CodeGenFunction::EmitObjCCollectionLiteral(const Expr *E, - const ObjCMethodDecl *MethodWithObjects) { + const ObjCMethodDecl *MethodWithObjects, + const ObjCMethodDecl *AllocMethod) { ASTContext &Context = CGM.getContext(); const ObjCDictionaryLiteral *DLE = nullptr; const ObjCArrayLiteral *ALE = dyn_cast<ObjCArrayLiteral>(E); @@ -203,12 +204,14 @@ llvm::Value *CodeGenFunction::EmitObjCCollectionLiteral(const Expr *E, } llvm::Value *CodeGenFunction::EmitObjCArrayLiteral(const ObjCArrayLiteral *E) { - return EmitObjCCollectionLiteral(E, E->getArrayWithObjectsMethod()); + return EmitObjCCollectionLiteral(E, E->getArrayWithObjectsMethod(), + E->getArrayAllocMethod()); } llvm::Value *CodeGenFunction::EmitObjCDictionaryLiteral( const ObjCDictionaryLiteral *E) { - return EmitObjCCollectionLiteral(E, E->getDictWithObjectsMethod()); + return EmitObjCCollectionLiteral(E, E->getDictWithObjectsMethod(), + E->getDictAllocMethod()); } /// Emit a selector. diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index a200548aa0e..d1999296e69 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -2304,7 +2304,8 @@ public: llvm::Value *EmitObjCArrayLiteral(const ObjCArrayLiteral *E); llvm::Value *EmitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E); llvm::Value *EmitObjCCollectionLiteral(const Expr *E, - const ObjCMethodDecl *MethodWithObjects); + const ObjCMethodDecl *MethodWithObjects, + const ObjCMethodDecl *AllocMethod); llvm::Value *EmitObjCSelectorExpr(const ObjCSelectorExpr *E); RValue EmitObjCMessageExpr(const ObjCMessageExpr *E, ReturnValueSlot Return = ReturnValueSlot()); diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 126cd1527c0..4a844c59d29 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -740,7 +740,7 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) { return MaybeBindToTemporary( ObjCArrayLiteral::Create(Context, Elements, Ty, - ArrayWithObjectsMethod, SR)); + ArrayWithObjectsMethod, nullptr, SR)); } ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, @@ -925,7 +925,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, Context.getObjCInterfaceType(NSDictionaryDecl)); return MaybeBindToTemporary(ObjCDictionaryLiteral::Create( Context, makeArrayRef(Elements, NumElements), HasPackExpansions, Ty, - DictionaryWithObjectsMethod, SR)); + DictionaryWithObjectsMethod, nullptr, SR)); } ExprResult Sema::BuildObjCEncodeExpression(SourceLocation AtLoc, diff --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp index c4e88f0f18d..c22bc3eff33 100644 --- a/clang/lib/Serialization/ASTReaderStmt.cpp +++ b/clang/lib/Serialization/ASTReaderStmt.cpp @@ -935,6 +935,7 @@ void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) { 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); } @@ -955,6 +956,7 @@ void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) { } } E->DictWithObjectsMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx); + E->DictAllocMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx); E->Range = ReadSourceRange(Record, Idx); } diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp index 462271a0ea7..f77f4b947c1 100644 --- a/clang/lib/Serialization/ASTWriterStmt.cpp +++ b/clang/lib/Serialization/ASTWriterStmt.cpp @@ -878,6 +878,7 @@ void ASTStmtWriter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) { 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; } @@ -900,6 +901,7 @@ void ASTStmtWriter::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) { } Writer.AddDeclRef(E->getDictWithObjectsMethod(), Record); + Writer.AddDeclRef(E->getDictAllocMethod(), Record); Writer.AddSourceRange(E->getSourceRange(), Record); Code = serialization::EXPR_OBJC_DICTIONARY_LITERAL; } |