[cfe-commits] r72292 - in /cfe/trunk/lib/Frontend: PCHReader.cpp PCHReaderDecl.cpp PCHReaderStmt.cpp
Douglas Gregor
dgregor at apple.com
Fri May 22 15:45:36 PDT 2009
Author: dgregor
Date: Fri May 22 17:45:36 2009
New Revision: 72292
URL: http://llvm.org/viewvc/llvm-project?rev=72292&view=rev
Log:
Fix lots of PCH crashes caused by the new assertions in
llvm::SmallVector, using data() instead of &[0]. The PCH testsuite now
runs cleanly (again).
Modified:
cfe/trunk/lib/Frontend/PCHReader.cpp
cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
cfe/trunk/lib/Frontend/PCHReaderStmt.cpp
Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=72292&r1=72291&r2=72292&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Fri May 22 17:45:36 2009
@@ -117,7 +117,7 @@
for (unsigned I = 1; I != N; ++I)
Args.push_back(Reader.DecodeIdentifierInfo(ReadUnalignedLE32(d)));
- return SelTable.getSelector(N, &Args[0]);
+ return SelTable.getSelector(N, Args.data());
}
data_type ReadData(Selector, const unsigned char* d, unsigned DataLen) {
@@ -946,7 +946,7 @@
MI->setIsFunctionLike();
if (isC99VarArgs) MI->setIsC99Varargs();
if (isGNUVarArgs) MI->setIsGNUVarargs();
- MI->setArgumentList(&MacroArgs[0], MacroArgs.size(),
+ MI->setArgumentList(MacroArgs.data(), MacroArgs.size(),
PP.getPreprocessorAllocator());
}
@@ -1710,7 +1710,7 @@
llvm::SmallVector<ObjCProtocolDecl*, 4> Protos;
for (unsigned I = 0; I != NumProtos; ++I)
Protos.push_back(cast<ObjCProtocolDecl>(GetDecl(Record[Idx++])));
- return Context->getObjCQualifiedInterfaceType(ItfD, &Protos[0], NumProtos);
+ return Context->getObjCQualifiedInterfaceType(ItfD, Protos.data(), NumProtos);
}
case pch::TYPE_OBJC_QUALIFIED_ID: {
@@ -1719,7 +1719,7 @@
llvm::SmallVector<ObjCProtocolDecl*, 4> Protos;
for (unsigned I = 0; I != NumProtos; ++I)
Protos.push_back(cast<ObjCProtocolDecl>(GetDecl(Record[Idx++])));
- return Context->getObjCQualifiedIdType(&Protos[0], NumProtos);
+ return Context->getObjCQualifiedIdType(Protos.data(), NumProtos);
}
}
// Suppress a GCC warning
Modified: cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderDecl.cpp?rev=72292&r1=72291&r2=72292&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReaderDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReaderDecl.cpp Fri May 22 17:45:36 2009
@@ -247,7 +247,7 @@
ClassRefs.reserve(NumClassRefs);
for (unsigned I = 0; I != NumClassRefs; ++I)
ClassRefs.push_back(cast<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
- CD->setClassList(*Reader.getContext(), &ClassRefs[0], NumClassRefs);
+ CD->setClassList(*Reader.getContext(), ClassRefs.data(), NumClassRefs);
}
void PCHDeclReader::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *FPD) {
@@ -257,7 +257,7 @@
ProtoRefs.reserve(NumProtoRefs);
for (unsigned I = 0; I != NumProtoRefs; ++I)
ProtoRefs.push_back(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++])));
- FPD->setProtocolList(&ProtoRefs[0], NumProtoRefs, *Reader.getContext());
+ FPD->setProtocolList(ProtoRefs.data(), NumProtoRefs, *Reader.getContext());
}
void PCHDeclReader::VisitObjCCategoryDecl(ObjCCategoryDecl *CD) {
@@ -373,7 +373,7 @@
Params.reserve(NumParams);
for (unsigned I = 0; I != NumParams; ++I)
Params.push_back(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
- BD->setParams(*Reader.getContext(), &Params[0], NumParams);
+ BD->setParams(*Reader.getContext(), Params.data(), NumParams);
}
std::pair<uint64_t, uint64_t>
@@ -483,7 +483,7 @@
llvm::SmallVector<unsigned, 16> ArgNums;
ArgNums.insert(ArgNums.end(), &Record[Idx], &Record[Idx] + Size);
Idx += Size;
- New = ::new (*Context) NonNullAttr(&ArgNums[0], Size);
+ New = ::new (*Context) NonNullAttr(ArgNums.data(), Size);
break;
}
Modified: cfe/trunk/lib/Frontend/PCHReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderStmt.cpp?rev=72292&r1=72291&r2=72292&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReaderStmt.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReaderStmt.cpp Fri May 22 17:45:36 2009
@@ -274,7 +274,8 @@
for (unsigned N = Record.size(); Idx != N; ++Idx)
Decls.push_back(Reader.GetDecl(Record[Idx]));
S->setDeclGroup(DeclGroupRef(DeclGroup::Create(*Reader.getContext(),
- &Decls[0], Decls.size())));
+ Decls.data(),
+ Decls.size())));
}
return 0;
}
@@ -369,7 +370,7 @@
// Read string data
llvm::SmallVector<char, 16> Str(&Record[Idx], &Record[Idx] + Len);
- E->setStrData(*Reader.getContext(), &Str[0], Len);
+ E->setStrData(*Reader.getContext(), Str.data(), Len);
Idx += Len;
// Read source locations
@@ -585,7 +586,7 @@
}
}
}
- E->setDesignators(&Designators[0], Designators.size());
+ E->setDesignators(Designators.data(), Designators.size());
return NumSubExprs;
}
More information about the cfe-commits
mailing list