[cfe-commits] r72210 - in /cfe/trunk: include/clang/Basic/ lib/AST/ lib/CodeGen/ lib/Frontend/ lib/Lex/ lib/Parse/ lib/Sema/

Jay Foad jay.foad at gmail.com
Thu May 21 02:52:52 PDT 2009


Author: foad
Date: Thu May 21 04:52:38 2009
New Revision: 72210

URL: http://llvm.org/viewvc/llvm-project?rev=72210&view=rev
Log:
Use v.data() instead of &v[0] when SmallVector v might be empty.

Modified:
    cfe/trunk/include/clang/Basic/IdentifierTable.h
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/lib/AST/Builtins.cpp
    cfe/trunk/lib/CodeGen/CGBuiltin.cpp
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/CGStmt.cpp
    cfe/trunk/lib/Frontend/PCHReader.cpp
    cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
    cfe/trunk/lib/Frontend/PCHReaderStmt.cpp
    cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
    cfe/trunk/lib/Lex/PPDirectives.cpp
    cfe/trunk/lib/Lex/PPMacroExpansion.cpp
    cfe/trunk/lib/Parse/AstGuard.h
    cfe/trunk/lib/Parse/ParseDecl.cpp
    cfe/trunk/lib/Parse/ParseDeclCXX.cpp
    cfe/trunk/lib/Parse/ParseExpr.cpp
    cfe/trunk/lib/Parse/ParseExprCXX.cpp
    cfe/trunk/lib/Parse/ParseObjc.cpp
    cfe/trunk/lib/Parse/ParseStmt.cpp
    cfe/trunk/lib/Parse/ParseTemplate.cpp
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaInit.cpp
    cfe/trunk/lib/Sema/SemaStmt.cpp
    cfe/trunk/lib/Sema/SemaTemplate.cpp
    cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
    cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
    cfe/trunk/lib/Sema/SemaType.cpp

Modified: cfe/trunk/include/clang/Basic/IdentifierTable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/IdentifierTable.h?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/IdentifierTable.h (original)
+++ cfe/trunk/include/clang/Basic/IdentifierTable.h Thu May 21 04:52:38 2009
@@ -339,7 +339,7 @@
   }
   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 @@
     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);
   }
 };

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu May 21 04:52:38 2009
@@ -1361,7 +1361,7 @@
       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.

Modified: cfe/trunk/lib/AST/Builtins.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Builtins.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Builtins.cpp (original)
+++ cfe/trunk/lib/AST/Builtins.cpp Thu May 21 04:52:38 2009
@@ -285,6 +285,6 @@
   // 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);
 }

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu May 21 04:52:38 2009
@@ -547,7 +547,7 @@
       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;

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu May 21 04:52:38 2009
@@ -2091,11 +2091,11 @@
   
   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);
   }
 

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu May 21 04:52:38 2009
@@ -609,7 +609,7 @@
   }
   
   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 @@
   
   // 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();

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Thu May 21 04:52:38 2009
@@ -801,7 +801,7 @@
   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");

Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Thu May 21 04:52:38 2009
@@ -1670,7 +1670,7 @@
       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 @@
 // \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;
 }

Modified: cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderDecl.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHReaderDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReaderDecl.cpp Thu May 21 04:52:38 2009
@@ -161,7 +161,7 @@
   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 @@
   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 @@
   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 @@
   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) {

Modified: cfe/trunk/lib/Frontend/PCHReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderStmt.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHReaderStmt.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReaderStmt.cpp Thu May 21 04:52:38 2009
@@ -129,7 +129,7 @@
   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 @@
     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;

Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Thu May 21 04:52:38 2009
@@ -68,7 +68,7 @@
     // 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);
   }

Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Thu May 21 04:52:38 2009
@@ -1049,8 +1049,8 @@
     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);

Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Thu May 21 04:52:38 2009
@@ -439,7 +439,8 @@
     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

Modified: cfe/trunk/lib/Parse/AstGuard.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/AstGuard.h?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/AstGuard.h (original)
+++ cfe/trunk/lib/Parse/AstGuard.h Thu May 21 04:52:38 2009
@@ -56,7 +56,7 @@
 #if !defined(DISABLE_SMART_POINTERS)
       Owns = false;
 #endif
-      return &(*this)[0];
+      return this->data();
     }
 
 #if !defined(DISABLE_SMART_POINTERS)

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Thu May 21 04:52:38 2009
@@ -377,7 +377,7 @@
              "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 @@
     ParseDeclarator(D);
   }
   
-  return Actions.FinalizeDeclaratorGroup(CurScope, &DeclsInGroup[0],
+  return Actions.FinalizeDeclaratorGroup(CurScope, DeclsInGroup.data(),
                                          DeclsInGroup.size());
 }
 
@@ -1387,7 +1387,7 @@
     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 @@
   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 @@
   // 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,

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Thu May 21 04:52:38 2009
@@ -652,7 +652,7 @@
   }
 
   // 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 @@
 
   if (Tok.is(tok::semi)) {
     ConsumeToken();
-    Actions.FinalizeDeclaratorGroup(CurScope, &DeclsInGroup[0],
+    Actions.FinalizeDeclaratorGroup(CurScope, DeclsInGroup.data(),
                                     DeclsInGroup.size());
     return;
   }
@@ -1137,7 +1137,7 @@
   } 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 @@
 
   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

Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Thu May 21 04:52:38 2009
@@ -876,7 +876,7 @@
         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());
       }
       

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Thu May 21 04:52:38 2009
@@ -467,7 +467,7 @@
          "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.

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Thu May 21 04:52:38 2009
@@ -158,10 +158,13 @@
     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 @@
   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 @@
   // 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 @@
   // 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 @@
   
   DeclPtrTy ProtoType =
     Actions.ActOnStartProtocolInterface(AtLoc, protocolName, nameLoc,
-                                        &ProtocolRefs[0], ProtocolRefs.size(),
+                                        ProtocolRefs.data(),
+                                        ProtocolRefs.size(),
                                         EndProtoLoc, attrList);
   ParseObjCInterfaceDeclList(ProtoType, tok::objc_protocol);
   return ProtoType;

Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Thu May 21 04:52:38 2009
@@ -1210,7 +1210,7 @@
   }
 
   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);

Modified: cfe/trunk/lib/Parse/ParseTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTemplate.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseTemplate.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTemplate.cpp Thu May 21 04:52:38 2009
@@ -106,7 +106,7 @@
     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 @@
                                                   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?

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu May 21 04:52:38 2009
@@ -456,7 +456,7 @@
     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 @@
       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 @@
         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 @@
            "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 @@
     }
   }
   return DeclGroupPtrTy::make(DeclGroupRef::Create(Context,
-                                                   &Decls[0], Decls.size()));
+                                                   Decls.data(), Decls.size()));
 }
 
 
@@ -4084,7 +4084,8 @@
   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);

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Thu May 21 04:52:38 2009
@@ -1651,7 +1651,7 @@
     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;

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu May 21 04:52:38 2009
@@ -5144,7 +5144,7 @@
       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 @@
   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

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Thu May 21 04:52:38 2009
@@ -1687,8 +1687,9 @@
   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);
 }

Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Thu May 21 04:52:38 2009
@@ -1000,7 +1000,7 @@
     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)

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu May 21 04:52:38 2009
@@ -879,7 +879,8 @@
   translateTemplateArguments(TemplateArgsIn, TemplateArgLocs, TemplateArgs);
 
   QualType Result = CheckTemplateIdType(Template, TemplateLoc, LAngleLoc,
-                                        &TemplateArgs[0], TemplateArgs.size(),
+                                        TemplateArgs.data(),
+                                        TemplateArgs.size(),
                                         RAngleLoc);
   TemplateArgsIn.release();
 

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Thu May 21 04:52:38 2009
@@ -686,7 +686,7 @@
   }
 
   if (!Invalid &&
-      AttachBaseSpecifiers(Instantiation, &InstantiatedBases[0],
+      AttachBaseSpecifiers(Instantiation, InstantiatedBases.data(),
                            InstantiatedBases.size()))
     Invalid = true;
 
@@ -770,7 +770,7 @@
 
   // Finish checking fields.
   ActOnFields(0, Instantiation->getLocation(), DeclPtrTy::make(Instantiation),
-              &Fields[0], Fields.size(), SourceLocation(), SourceLocation(),
+              Fields.data(), Fields.size(), SourceLocation(), SourceLocation(),
               0);
 
   // Add any implicitly-declared members that we might need.

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Thu May 21 04:52:38 2009
@@ -301,7 +301,7 @@
   // Attach the parameters
   for (unsigned P = 0; P < Params.size(); ++P)
     Params[P]->setOwningFunction(Method);
-  Method->setParams(SemaRef.Context, &Params[0], Params.size());
+  Method->setParams(SemaRef.Context, Params.data(), Params.size());
 
   if (InitMethodInstantiation(Method, D))
     Method->setInvalidDecl();
@@ -348,7 +348,7 @@
   // Attach the parameters
   for (unsigned P = 0; P < Params.size(); ++P)
     Params[P]->setOwningFunction(Constructor);
-  Constructor->setParams(SemaRef.Context, &Params[0], Params.size());
+  Constructor->setParams(SemaRef.Context, Params.data(), Params.size());
 
   if (InitMethodInstantiation(Constructor, D))
     Constructor->setInvalidDecl();
@@ -538,7 +538,7 @@
   if (ResultType.isNull())
     return QualType();
 
-  return SemaRef.BuildFunctionType(ResultType, &ParamTys[0], ParamTys.size(),
+  return SemaRef.BuildFunctionType(ResultType, ParamTys.data(), ParamTys.size(),
                                    Proto->isVariadic(), Proto->getTypeQuals(),
                                    D->getLocation(), D->getDeclName());
 }

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=72210&r1=72209&r2=72210&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Thu May 21 04:52:38 2009
@@ -795,7 +795,7 @@
           
           ArgTys.push_back(ArgTy);
         }
-        T = Context.getFunctionType(T, &ArgTys[0], ArgTys.size(),
+        T = Context.getFunctionType(T, ArgTys.data(), ArgTys.size(),
                                     FTI.isVariadic, FTI.TypeQuals);
       }
       break;





More information about the cfe-commits mailing list