diff options
30 files changed, 80 insertions, 70 deletions
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index 69b7bafbae..57cd311631 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -339,7 +339,7 @@ public: } IdentifierInfo &get(const std::string &Name) { // Don't use c_str() here: no need to be null terminated. - const char *NameBytes = &Name[0]; + const char *NameBytes = Name.data(); return get(NameBytes, NameBytes+Name.size()); } @@ -470,8 +470,9 @@ public: SelectorName = "set"; SelectorName.append(Name->getName(), Name->getName()+Name->getLength()); SelectorName[3] = toupper(SelectorName[3]); - IdentifierInfo *SetterName = - &Idents.get(&SelectorName[0], &SelectorName[SelectorName.size()]); + IdentifierInfo *SetterName = + &Idents.get(SelectorName.data(), + SelectorName.data() + SelectorName.size()); return SelTable.getUnarySelector(SetterName); } }; diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 329d6c478d..ccbea263aa 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1361,7 +1361,7 @@ QualType ASTContext::getFunctionType(QualType ResultTy,const QualType *ArgArray, CanonicalArgs.push_back(getCanonicalType(ArgArray[i])); Canonical = getFunctionType(getCanonicalType(ResultTy), - &CanonicalArgs[0], NumArgs, + CanonicalArgs.data(), NumArgs, isVariadic, TypeQuals); // Get the new insert position for the node we care about. diff --git a/lib/AST/Builtins.cpp b/lib/AST/Builtins.cpp index ca75c5d51a..8368febe5a 100644 --- a/lib/AST/Builtins.cpp +++ b/lib/AST/Builtins.cpp @@ -285,6 +285,6 @@ QualType Builtin::Context::GetBuiltinType(unsigned id, ASTContext &Context, // handle untyped/variadic arguments "T c99Style();" or "T cppStyle(...);". if (ArgTypes.size() == 0 && TypeStr[0] == '.') return Context.getFunctionNoProtoType(ResType); - return Context.getFunctionType(ResType, &ArgTypes[0], ArgTypes.size(), + return Context.getFunctionType(ResType, ArgTypes.data(), ArgTypes.size(), TypeStr[0] == '.', 0); } diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index b316d45004..6692b6cd9f 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -547,7 +547,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, Args.push_back(ArgValue); } - Value *V = Builder.CreateCall(F, &Args[0], &Args[0] + Args.size()); + Value *V = Builder.CreateCall(F, Args.data(), Args.data() + Args.size()); QualType BuiltinRetType = E->getType(); const llvm::Type *RetTy = llvm::Type::VoidTy; diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index d444baec8e..718a51512a 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -2091,11 +2091,11 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, llvm::CallSite CS; if (!InvokeDest || (Attrs.getFnAttributes() & llvm::Attribute::NoUnwind)) { - CS = Builder.CreateCall(Callee, &Args[0], &Args[0]+Args.size()); + CS = Builder.CreateCall(Callee, Args.data(), Args.data()+Args.size()); } else { llvm::BasicBlock *Cont = createBasicBlock("invoke.cont"); CS = Builder.CreateInvoke(Callee, Cont, InvokeDest, - &Args[0], &Args[0]+Args.size()); + Args.data(), Args.data()+Args.size()); EmitBlock(Cont); } diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 382b186648..b005d0543e 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -609,7 +609,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, } llvm::DIArray Elements = - DebugFactory.GetOrCreateArray(&EltTys[0], EltTys.size()); + DebugFactory.GetOrCreateArray(EltTys.data(), EltTys.size()); // Bit size, align and offset of the type. uint64_t Size = M->getContext().getTypeSize(Ty); @@ -645,7 +645,7 @@ llvm::DIType CGDebugInfo::CreateType(const EnumType *Ty, // Return a CompositeType for the enum itself. llvm::DIArray EltArray = - DebugFactory.GetOrCreateArray(&Enumerators[0], Enumerators.size()); + DebugFactory.GetOrCreateArray(Enumerators.data(), Enumerators.size()); std::string EnumName = Decl->getNameAsString(); SourceLocation DefLoc = Decl->getLocation(); diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 7f73c8886c..da586b1d74 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -801,7 +801,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { for (unsigned i = 0, e = S.getNumInputs(); i != e; i++) { TargetInfo::ConstraintInfo Info(S.getInputConstraint(i), S.getInputName(i)); - bool result = Target.validateInputConstraint(&OutputConstraintInfos[0], + bool result = Target.validateInputConstraint(OutputConstraintInfos.data(), S.getNumOutputs(), Info); result=result; assert(result && "Failed to parse input constraint"); diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index 25415bb368..4da4538f3e 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -1670,7 +1670,7 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) { ParamTypes.push_back(GetType(Record[Idx++])); bool isVariadic = Record[Idx++]; unsigned Quals = Record[Idx++]; - return Context->getFunctionType(ResultType, &ParamTypes[0], NumParams, + return Context->getFunctionType(ResultType, ParamTypes.data(), NumParams, isVariadic, Quals); } @@ -2151,7 +2151,7 @@ llvm::APFloat PCHReader::ReadAPFloat(const RecordData &Record, unsigned &Idx) { // \brief Read a string std::string PCHReader::ReadString(const RecordData &Record, unsigned &Idx) { unsigned Len = Record[Idx++]; - std::string Result(&Record[Idx], &Record[Idx] + Len); + std::string Result(Record.data() + Idx, Record.data() + Idx + Len); Idx += Len; return Result; } diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp index 870392b07b..64c8e6f7c6 100644 --- a/lib/Frontend/PCHReaderDecl.cpp +++ b/lib/Frontend/PCHReaderDecl.cpp @@ -161,7 +161,7 @@ void PCHDeclReader::VisitFunctionDecl(FunctionDecl *FD) { Params.reserve(NumParams); for (unsigned I = 0; I != NumParams; ++I) Params.push_back(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++]))); - FD->setParams(*Reader.getContext(), &Params[0], NumParams); + FD->setParams(*Reader.getContext(), Params.data(), NumParams); } void PCHDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) { @@ -185,7 +185,7 @@ void PCHDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) { Params.reserve(NumParams); for (unsigned I = 0; I != NumParams; ++I) Params.push_back(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++]))); - MD->setMethodParams(*Reader.getContext(), &Params[0], NumParams); + MD->setMethodParams(*Reader.getContext(), Params.data(), NumParams); } void PCHDeclReader::VisitObjCContainerDecl(ObjCContainerDecl *CD) { @@ -203,13 +203,13 @@ void PCHDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) { Protocols.reserve(NumProtocols); for (unsigned I = 0; I != NumProtocols; ++I) Protocols.push_back(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++]))); - ID->setProtocolList(&Protocols[0], NumProtocols, *Reader.getContext()); + ID->setProtocolList(Protocols.data(), NumProtocols, *Reader.getContext()); unsigned NumIvars = Record[Idx++]; llvm::SmallVector<ObjCIvarDecl *, 16> IVars; IVars.reserve(NumIvars); for (unsigned I = 0; I != NumIvars; ++I) IVars.push_back(cast<ObjCIvarDecl>(Reader.GetDecl(Record[Idx++]))); - ID->setIVarList(&IVars[0], NumIvars, *Reader.getContext()); + ID->setIVarList(IVars.data(), NumIvars, *Reader.getContext()); ID->setCategoryList( cast_or_null<ObjCCategoryDecl>(Reader.GetDecl(Record[Idx++]))); ID->setForwardDecl(Record[Idx++]); @@ -233,7 +233,7 @@ void PCHDeclReader::VisitObjCProtocolDecl(ObjCProtocolDecl *PD) { ProtoRefs.reserve(NumProtoRefs); for (unsigned I = 0; I != NumProtoRefs; ++I) ProtoRefs.push_back(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++]))); - PD->setProtocolList(&ProtoRefs[0], NumProtoRefs, *Reader.getContext()); + PD->setProtocolList(ProtoRefs.data(), NumProtoRefs, *Reader.getContext()); } void PCHDeclReader::VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *FD) { diff --git a/lib/Frontend/PCHReaderStmt.cpp b/lib/Frontend/PCHReaderStmt.cpp index d4ff6adda0..03c5d25a7b 100644 --- a/lib/Frontend/PCHReaderStmt.cpp +++ b/lib/Frontend/PCHReaderStmt.cpp @@ -129,7 +129,7 @@ unsigned PCHStmtReader::VisitCompoundStmt(CompoundStmt *S) { VisitStmt(S); unsigned NumStmts = Record[Idx++]; S->setStmts(*Reader.getContext(), - &StmtStack[StmtStack.size() - NumStmts], NumStmts); + StmtStack.data() + StmtStack.size() - NumStmts, NumStmts); S->setLBracLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); S->setRBracLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); return NumStmts; @@ -303,13 +303,13 @@ unsigned PCHStmtReader::VisitAsmStmt(AsmStmt *S) { Exprs.push_back(StmtStack[StackIdx++]); } S->setOutputsAndInputs(NumOutputs, NumInputs, - &Names[0], &Constraints[0], &Exprs[0]); + Names.data(), Constraints.data(), Exprs.data()); // Constraints llvm::SmallVector<StringLiteral*, 16> Clobbers; for (unsigned I = 0; I != NumClobbers; ++I) Clobbers.push_back(cast_or_null<StringLiteral>(StmtStack[StackIdx++])); - S->setClobbers(&Clobbers[0], NumClobbers); + S->setClobbers(Clobbers.data(), NumClobbers); assert(StackIdx == StmtStack.size() && "Error deserializing AsmStmt"); return NumOutputs*2 + NumInputs*2 + NumClobbers + 1; diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp index d88e57d85d..e79453c28c 100644 --- a/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/lib/Frontend/PrintPreprocessedOutput.cpp @@ -68,7 +68,7 @@ static void PrintMacroDefinition(const IdentifierInfo &II, const MacroInfo &MI, // Make sure we have enough space in the spelling buffer. if (I->getLength() < SpellingBuffer.size()) SpellingBuffer.resize(I->getLength()); - const char *Buffer = &SpellingBuffer[0]; + const char *Buffer = SpellingBuffer.data(); unsigned SpellingLen = PP.getSpelling(*I, Buffer); OS.write(Buffer, SpellingLen); } diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index ca8693bf61..331424bdc8 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -1049,8 +1049,8 @@ void Preprocessor::HandleIncludeDirective(Token &IncludeTok, FilenameBuffer.push_back('<'); if (ConcatenateIncludeName(FilenameBuffer, *this)) return; // Found <eom> but no ">"? Diagnostic already emitted. - FilenameStart = &FilenameBuffer[0]; - FilenameEnd = &FilenameBuffer[FilenameBuffer.size()]; + FilenameStart = FilenameBuffer.data(); + FilenameEnd = FilenameStart + FilenameBuffer.size(); break; default: Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename); diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 18dcfb25e7..55222c944a 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -439,7 +439,8 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName, return 0; } - return MacroArgs::create(MI, &ArgTokens[0], ArgTokens.size(),isVarargsElided); + return MacroArgs::create(MI, ArgTokens.data(), ArgTokens.size(), + isVarargsElided); } /// ComputeDATE_TIME - Compute the current time, enter it into the specified diff --git a/lib/Parse/AstGuard.h b/lib/Parse/AstGuard.h index 602fea51dc..1ff6a4e35a 100644 --- a/lib/Parse/AstGuard.h +++ b/lib/Parse/AstGuard.h @@ -56,7 +56,7 @@ namespace clang #if !defined(DISABLE_SMART_POINTERS) Owns = false; #endif - return &(*this)[0]; + return this->data(); } #if !defined(DISABLE_SMART_POINTERS) diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index db24d21c32..4c2a77e7d0 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -377,7 +377,7 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D) { "Unexpected number of commas!"); Actions.AddCXXDirectInitializerToDecl(ThisDecl, LParenLoc, move_arg(Exprs), - &CommaLocs[0], RParenLoc); + CommaLocs.data(), RParenLoc); } } else { Actions.ActOnUninitializedDecl(ThisDecl); @@ -438,7 +438,7 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) { ParseDeclarator(D); } - return Actions.FinalizeDeclaratorGroup(CurScope, &DeclsInGroup[0], + return Actions.FinalizeDeclaratorGroup(CurScope, DeclsInGroup.data(), DeclsInGroup.size()); } @@ -1387,7 +1387,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, AttrList = ParseAttributes(); Actions.ActOnFields(CurScope, - RecordLoc,TagDecl,&FieldDecls[0],FieldDecls.size(), + RecordLoc, TagDecl, FieldDecls.data(), FieldDecls.size(), LBraceLoc, RBraceLoc, AttrList); StructScope.Exit(); @@ -1537,7 +1537,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, DeclPtrTy EnumDecl) { SourceLocation RBraceLoc = MatchRHSPunctuation(tok::r_brace, LBraceLoc); Actions.ActOnEnumBody(StartLoc, LBraceLoc, RBraceLoc, EnumDecl, - &EnumConstantDecls[0], EnumConstantDecls.size()); + EnumConstantDecls.data(), EnumConstantDecls.size()); Action::AttrTy *AttrList = 0; // If attributes exist after the identifier list, parse them. @@ -2462,7 +2462,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, // Remember that we parsed a function type, and remember the attributes. D.AddTypeInfo(DeclaratorChunk::getFunction(/*proto*/true, IsVariadic, EllipsisLoc, - &ParamInfo[0], ParamInfo.size(), + ParamInfo.data(), ParamInfo.size(), DS.getTypeQualifiers(), hasExceptionSpec, hasAnyExceptionSpec, diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 963c5adf00..b900e25c69 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -652,7 +652,7 @@ void Parser::ParseBaseClause(DeclPtrTy ClassDecl) { } // Attach the base specifiers - Actions.ActOnBaseSpecifiers(ClassDecl, &BaseInfo[0], BaseInfo.size()); + Actions.ActOnBaseSpecifiers(ClassDecl, BaseInfo.data(), BaseInfo.size()); } /// ParseBaseSpecifier - Parse a C++ base-specifier. A base-specifier is @@ -970,7 +970,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS) { if (Tok.is(tok::semi)) { ConsumeToken(); - Actions.FinalizeDeclaratorGroup(CurScope, &DeclsInGroup[0], + Actions.FinalizeDeclaratorGroup(CurScope, DeclsInGroup.data(), DeclsInGroup.size()); return; } @@ -1137,7 +1137,7 @@ void Parser::ParseConstructorInitializer(DeclPtrTy ConstructorDecl) { } while (true); Actions.ActOnMemInitializers(ConstructorDecl, ColonLoc, - &MemInitializers[0], MemInitializers.size()); + MemInitializers.data(), MemInitializers.size()); } /// ParseMemInitializer - Parse a C++ member initializer, which is @@ -1183,7 +1183,8 @@ Parser::MemInitResult Parser::ParseMemInitializer(DeclPtrTy ConstructorDecl) { return Actions.ActOnMemInitializer(ConstructorDecl, CurScope, II, IdLoc, LParenLoc, ArgExprs.take(), - ArgExprs.size(), &CommaLocs[0], RParenLoc); + ArgExprs.size(), CommaLocs.data(), + RParenLoc); } /// ParseExceptionSpecification - Parse a C++ exception-specification diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index 55fc0cdd6c..527fd4695c 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -876,7 +876,7 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) { assert((ArgExprs.size() == 0 || ArgExprs.size()-1 == CommaLocs.size())&& "Unexpected number of commas!"); LHS = Actions.ActOnCallExpr(CurScope, move(LHS), Loc, - move_arg(ArgExprs), &CommaLocs[0], + move_arg(ArgExprs), CommaLocs.data(), Tok.getLocation()); } diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index 4becfc83c9..d2d9a87f49 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -467,7 +467,7 @@ Parser::ParseCXXTypeConstructExpression(const DeclSpec &DS) { "Unexpected number of commas!"); return Actions.ActOnCXXTypeConstructExpr(DS.getSourceRange(), TypeRep, LParenLoc, move_arg(Exprs), - &CommaLocs[0], RParenLoc); + CommaLocs.data(), RParenLoc); } /// ParseCXXCondition - if/switch/while/for condition expression. diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index e1d0bb6e13..571c610836 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -158,10 +158,13 @@ Parser::DeclPtrTy Parser::ParseObjCAtInterfaceDeclaration( if (attrList) // categories don't support attributes. Diag(Tok, diag::err_objc_no_attributes_on_category); - DeclPtrTy CategoryType = Actions.ActOnStartCategoryInterface(atLoc, - nameId, nameLoc, categoryId, categoryLoc, - &ProtocolRefs[0], ProtocolRefs.size(), - EndProtoLoc); + DeclPtrTy CategoryType = + Actions.ActOnStartCategoryInterface(atLoc, + nameId, nameLoc, + categoryId, categoryLoc, + ProtocolRefs.data(), + ProtocolRefs.size(), + EndProtoLoc); ParseObjCInterfaceDeclList(CategoryType, tok::objc_not_keyword); return CategoryType; @@ -189,7 +192,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtInterfaceDeclaration( DeclPtrTy ClsType = Actions.ActOnStartClassInterface(atLoc, nameId, nameLoc, superClassId, superClassLoc, - &ProtocolRefs[0], ProtocolRefs.size(), + ProtocolRefs.data(), ProtocolRefs.size(), EndProtoLoc, attrList); if (Tok.is(tok::l_brace)) @@ -358,9 +361,9 @@ void Parser::ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl, // Insert collected methods declarations into the @interface object. // This passes in an invalid SourceLocation for AtEndLoc when EOF is hit. Actions.ActOnAtEnd(AtEndLoc, interfaceDecl, - &allMethods[0], allMethods.size(), - &allProperties[0], allProperties.size(), - &allTUVariables[0], allTUVariables.size()); + allMethods.data(), allMethods.size(), + allProperties.data(), allProperties.size(), + allTUVariables.data(), allTUVariables.size()); } /// Parse property attribute declarations. @@ -905,7 +908,7 @@ void Parser::ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl, // Call ActOnFields() even if we don't have any decls. This is useful // for code rewriting tools that need to be aware of the empty list. Actions.ActOnFields(CurScope, atLoc, interfaceDecl, - &AllIvarDecls[0], AllIvarDecls.size(), + AllIvarDecls.data(), AllIvarDecls.size(), LBraceLoc, RBraceLoc, 0); return; } @@ -986,7 +989,8 @@ Parser::DeclPtrTy Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc, DeclPtrTy ProtoType = Actions.ActOnStartProtocolInterface(AtLoc, protocolName, nameLoc, - &ProtocolRefs[0], ProtocolRefs.size(), + ProtocolRefs.data(), + ProtocolRefs.size(), EndProtoLoc, attrList); ParseObjCInterfaceDeclList(ProtoType, tok::objc_protocol); return ProtoType; diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index 1bcfed7e20..842235264e 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -1210,7 +1210,7 @@ Parser::OwningStmtResult Parser::ParseAsmStatement(bool &msAsm) { } return Actions.ActOnAsmStmt(AsmLoc, isSimple, isVolatile, - NumOutputs, NumInputs, &Names[0], + NumOutputs, NumInputs, Names.data(), move_arg(Constraints), move_arg(Exprs), move(AsmString), move_arg(Clobbers), RParenLoc); diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp index 490f2769e1..f23f8c0c83 100644 --- a/lib/Parse/ParseTemplate.cpp +++ b/lib/Parse/ParseTemplate.cpp @@ -106,7 +106,7 @@ Parser::ParseTemplateDeclarationOrSpecialization(unsigned Context, ParamLists.push_back( Actions.ActOnTemplateParameterList(ParamLists.size(), ExportLoc, TemplateLoc, LAngleLoc, - &TemplateParams[0], + TemplateParams.data(), TemplateParams.size(), RAngleLoc)); } while (Tok.is(tok::kw_export) || Tok.is(tok::kw_template)); @@ -633,8 +633,8 @@ void Parser::AnnotateTemplateIdToken(TemplateTy Template, TemplateNameKind TNK, TemplateArgLocations, RAngleLoc); - ASTTemplateArgsPtr TemplateArgsPtr(Actions, &TemplateArgs[0], - &TemplateArgIsType[0], + ASTTemplateArgsPtr TemplateArgsPtr(Actions, TemplateArgs.data(), + TemplateArgIsType.data(), TemplateArgs.size()); if (Invalid) // FIXME: How to recover from a broken template-id? diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index ceb5822433..22bdc7999b 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -456,7 +456,7 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) Params.push_back(ParmVarDecl::Create(Context, New, SourceLocation(), 0, FT->getArgType(i), VarDecl::None, 0)); - New->setParams(Context, &Params[0], Params.size()); + New->setParams(Context, Params.data(), Params.size()); } AddKnownFunctionAttributes(New); @@ -732,7 +732,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { llvm::SmallVector<QualType, 16> ParamTypes(OldProto->arg_type_begin(), OldProto->arg_type_end()); NewQType = Context.getFunctionType(NewFuncType->getResultType(), - &ParamTypes[0], ParamTypes.size(), + ParamTypes.data(), ParamTypes.size(), OldProto->isVariadic(), OldProto->getTypeQuals()); New->setType(NewQType); @@ -752,7 +752,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { Params.push_back(Param); } - New->setParams(Context, &Params[0], Params.size()); + New->setParams(Context, Params.data(), Params.size()); } return MergeCompatibleFunctionDecls(New, Old); @@ -2243,7 +2243,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, "Should not need args for typedef of non-prototype fn"); } // Finally, we know we have the right number of parameters, install them. - NewFD->setParams(Context, &Params[0], Params.size()); + NewFD->setParams(Context, Params.data(), Params.size()); @@ -2804,7 +2804,7 @@ Sema::DeclGroupPtrTy Sema::FinalizeDeclaratorGroup(Scope *S, DeclPtrTy *Group, } } return DeclGroupPtrTy::make(DeclGroupRef::Create(Context, - &Decls[0], Decls.size())); + Decls.data(), Decls.size())); } @@ -4084,7 +4084,8 @@ void Sema::ActOnFields(Scope* S, if (Record) { Record->completeDefinition(Context); } else { - ObjCIvarDecl **ClsFields = reinterpret_cast<ObjCIvarDecl**>(&RecFields[0]); + ObjCIvarDecl **ClsFields = + reinterpret_cast<ObjCIvarDecl**>(RecFields.data()); if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(EnclosingDecl)) { ID->setIVarList(ClsFields, RecFields.size(), Context); ID->setLocEnd(RBrac); diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 13655ba092..35faa4a5ea 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1651,7 +1651,7 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration( Params.push_back(Param); } - ObjCMethod->setMethodParams(Context, &Params[0], Sel.getNumArgs()); + ObjCMethod->setMethodParams(Context, Params.data(), Sel.getNumArgs()); ObjCMethod->setObjCDeclQualifier( CvtQTToAstBitMask(ReturnQT.getObjCDeclQualifier())); const ObjCMethodDecl *PrevMethod = 0; diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index d72d56f1d6..e819b1c10f 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -5144,7 +5144,7 @@ void Sema::ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) { CurBlock->Params.push_back(FTI.ArgInfo[i].Param.getAs<ParmVarDecl>()); CurBlock->isVariadic = FTI.isVariadic; } - CurBlock->TheDecl->setParams(Context, &CurBlock->Params[0], + CurBlock->TheDecl->setParams(Context, CurBlock->Params.data(), CurBlock->Params.size()); CurBlock->TheDecl->setIsVariadic(CurBlock->isVariadic); ProcessDeclAttributes(CurBlock->TheDecl, ParamInfo); @@ -5215,7 +5215,7 @@ Sema::OwningExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, if (!BSI->hasPrototype) BlockTy = Context.getFunctionNoProtoType(RetTy); else - BlockTy = Context.getFunctionType(RetTy, &ArgTypes[0], ArgTypes.size(), + BlockTy = Context.getFunctionType(RetTy, ArgTypes.data(), ArgTypes.size(), BSI->isVariadic, 0); // FIXME: Check that return/parameter types are complete/non-abstract diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 17113f68bd..f3ad2a1b32 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -1687,8 +1687,9 @@ Sema::OwningExprResult Sema::ActOnDesignatedInitializer(Designation &Desig, Desig.ClearExprs(*this); DesignatedInitExpr *DIE - = DesignatedInitExpr::Create(Context, &Designators[0], Designators.size(), - &InitExpressions[0], InitExpressions.size(), + = DesignatedInitExpr::Create(Context, + Designators.data(), Designators.size(), + InitExpressions.data(), InitExpressions.size(), Loc, GNUSyntax, Init.takeAs<Expr>()); return Owned(DIE); } diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index ebaa99fa98..1a1362e669 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -1000,7 +1000,7 @@ Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, TargetInfo::ConstraintInfo Info(Literal->getStrData(), Literal->getByteLength(), Names[i]); - if (!Context.Target.validateInputConstraint(&OutputConstraintInfos[0], + if (!Context.Target.validateInputConstraint(OutputConstraintInfos.data(), NumOutputs, Info)) { return StmtError(Diag(Literal->getLocStart(), diag::err_asm_invalid_input_constraint) diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 47388ace34..c533789458 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/ |