unsafe, since many operations on the types can trigger lazy deserialization of
more types and invalidate the iterators. This fixes a crasher, but I've not
been able to reduce it to a reasonable testcase yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253420
91177308-0d34-0410-b5e6-
96231b3b80d8
// corresponding unsigned integer type.
QualType getCorrespondingUnsignedType(QualType T) const;
- //===--------------------------------------------------------------------===//
- // Type Iterators.
- //===--------------------------------------------------------------------===//
- typedef llvm::iterator_range<SmallVectorImpl<Type *>::const_iterator>
- type_const_range;
-
- type_const_range types() const {
- return type_const_range(Types.begin(), Types.end());
- }
-
//===--------------------------------------------------------------------===//
// Integer Values
//===--------------------------------------------------------------------===//
if (const Type *T = NNS->getAsType())
SSIsTemplate = T->getTypeClass() == Type::TemplateSpecialization;
}
- for (const auto *TI : SemaRef.getASTContext().types()) {
+ // Do not transform this into an iterator-based loop. The loop body can
+ // trigger the creation of further types (through lazy deserialization) and
+ // invalide iterators into this list.
+ auto &Types = SemaRef.getASTContext().getTypes();
+ for (unsigned I = 0; I != Types.size(); ++I) {
+ const auto *TI = Types[I];
if (!TI->isClassType() && isa<TemplateSpecializationType>(TI))
continue;
if (CXXRecordDecl *CD = TI->getAsCXXRecordDecl()) {