Author: ctopper Date: Thu Dec 24 17:58:15 2015 New Revision: 256398 URL: http://llvm.org/viewvc/llvm-project?rev=256398&view=rev Log: [Sema] ArrayRef-ize BuildObjCDictionaryLiteral. NFC
Modified: cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Parse/ParseObjc.cpp cfe/trunk/lib/Sema/SemaExprObjC.cpp cfe/trunk/lib/Sema/TreeTransform.h Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=256398&r1=256397&r2=256398&view=diff ============================================================================== --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Thu Dec 24 17:58:15 2015 @@ -5112,8 +5112,7 @@ public: ObjCMethodDecl *setterMethod); ExprResult BuildObjCDictionaryLiteral(SourceRange SR, - ObjCDictionaryElement *Elements, - unsigned NumElements); + MutableArrayRef<ObjCDictionaryElement> Elements); ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, Modified: cfe/trunk/lib/Parse/ParseObjc.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=256398&r1=256397&r2=256398&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseObjc.cpp (original) +++ cfe/trunk/lib/Parse/ParseObjc.cpp Thu Dec 24 17:58:15 2015 @@ -3435,7 +3435,7 @@ ExprResult Parser::ParseObjCDictionaryLi // Create the ObjCDictionaryLiteral. return Actions.BuildObjCDictionaryLiteral(SourceRange(AtLoc, EndLoc), - Elements.data(), Elements.size()); + Elements); } /// objc-encode-expression: Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=256398&r1=256397&r2=256398&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original) +++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Thu Dec 24 17:58:15 2015 @@ -865,9 +865,8 @@ ExprResult Sema::BuildObjCArrayLiteral(S ArrayWithObjectsMethod, SR)); } -ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, - ObjCDictionaryElement *Elements, - unsigned NumElements) { +ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, + MutableArrayRef<ObjCDictionaryElement> Elements) { SourceLocation Loc = SR.getBegin(); if (!NSDictionaryDecl) { @@ -1004,31 +1003,31 @@ ExprResult Sema::BuildObjCDictionaryLite // Check that each of the keys and values provided is valid in a collection // literal, performing conversions as necessary. bool HasPackExpansions = false; - for (unsigned I = 0, N = NumElements; I != N; ++I) { + for (ObjCDictionaryElement &Element : Elements) { // Check the key. - ExprResult Key = CheckObjCCollectionLiteralElement(*this, Elements[I].Key, + ExprResult Key = CheckObjCCollectionLiteralElement(*this, Element.Key, KeyT); if (Key.isInvalid()) return ExprError(); // Check the value. ExprResult Value - = CheckObjCCollectionLiteralElement(*this, Elements[I].Value, ValueT); + = CheckObjCCollectionLiteralElement(*this, Element.Value, ValueT); if (Value.isInvalid()) return ExprError(); - Elements[I].Key = Key.get(); - Elements[I].Value = Value.get(); + Element.Key = Key.get(); + Element.Value = Value.get(); - if (Elements[I].EllipsisLoc.isInvalid()) + if (Element.EllipsisLoc.isInvalid()) continue; - if (!Elements[I].Key->containsUnexpandedParameterPack() && - !Elements[I].Value->containsUnexpandedParameterPack()) { - Diag(Elements[I].EllipsisLoc, + if (!Element.Key->containsUnexpandedParameterPack() && + !Element.Value->containsUnexpandedParameterPack()) { + Diag(Element.EllipsisLoc, diag::err_pack_expansion_without_parameter_packs) - << SourceRange(Elements[I].Key->getLocStart(), - Elements[I].Value->getLocEnd()); + << SourceRange(Element.Key->getLocStart(), + Element.Value->getLocEnd()); return ExprError(); } @@ -1040,7 +1039,7 @@ ExprResult Sema::BuildObjCDictionaryLite = Context.getObjCObjectPointerType( Context.getObjCInterfaceType(NSDictionaryDecl)); return MaybeBindToTemporary(ObjCDictionaryLiteral::Create( - Context, makeArrayRef(Elements, NumElements), HasPackExpansions, Ty, + Context, Elements, HasPackExpansions, Ty, DictionaryWithObjectsMethod, SR)); } Modified: cfe/trunk/lib/Sema/TreeTransform.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=256398&r1=256397&r2=256398&view=diff ============================================================================== --- cfe/trunk/lib/Sema/TreeTransform.h (original) +++ cfe/trunk/lib/Sema/TreeTransform.h Thu Dec 24 17:58:15 2015 @@ -2765,9 +2765,8 @@ public: /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. ExprResult RebuildObjCDictionaryLiteral(SourceRange Range, - ObjCDictionaryElement *Elements, - unsigned NumElements) { - return getSema().BuildObjCDictionaryLiteral(Range, Elements, NumElements); + MutableArrayRef<ObjCDictionaryElement> Elements) { + return getSema().BuildObjCDictionaryLiteral(Range, Elements); } /// \brief Build a new Objective-C \@encode expression. @@ -10728,8 +10727,7 @@ TreeTransform<Derived>::TransformObjCDic return SemaRef.MaybeBindToTemporary(E); return getDerived().RebuildObjCDictionaryLiteral(E->getSourceRange(), - Elements.data(), - Elements.size()); + Elements); } template<typename Derived> _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits