aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaExprMember.cpp10
-rw-r--r--lib/Serialization/ASTReader.cpp16
-rw-r--r--lib/Serialization/ASTWriter.cpp8
3 files changed, 19 insertions, 15 deletions
diff --git a/lib/Sema/SemaExprMember.cpp b/lib/Sema/SemaExprMember.cpp
index e5940c667f..cde29f5b4c 100644
--- a/lib/Sema/SemaExprMember.cpp
+++ b/lib/Sema/SemaExprMember.cpp
@@ -337,10 +337,14 @@ CheckExtVectorComponent(Sema &S, QualType baseType, ExprValueKind &VK,
QualType VT = S.Context.getExtVectorType(vecType->getElementType(), CompSize);
// Now look up the TypeDefDecl from the vector type. Without this,
// diagostics look bad. We want extended vector types to appear built-in.
- for (unsigned i = 0, E = S.ExtVectorDecls.size(); i != E; ++i) {
- if (S.ExtVectorDecls[i]->getUnderlyingType() == VT)
- return S.Context.getTypedefType(S.ExtVectorDecls[i]);
+ for (Sema::ExtVectorDeclsType::iterator
+ I = S.ExtVectorDecls.begin(S.ExternalSource),
+ E = S.ExtVectorDecls.end();
+ I != E; ++I) {
+ if ((*I)->getUnderlyingType() == VT)
+ return S.Context.getTypedefType(*I);
}
+
return VT; // should never get here (a typedef type should always be found).
}
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index d39029ac6f..e8ae251e5a 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -4336,12 +4336,6 @@ void ASTReader::InitializeSema(Sema &S) {
SemaObj->LocallyScopedExternalDecls[D->getDeclName()] = D;
}
- // If there were any ext_vector type declarations, deserialize them
- // and add them to Sema's vector of such declarations.
- for (unsigned I = 0, N = ExtVectorDecls.size(); I != N; ++I)
- SemaObj->ExtVectorDecls.push_back(
- cast<TypedefNameDecl>(GetDecl(ExtVectorDecls[I])));
-
// FIXME: Do VTable uses and dynamic classes deserialize too much ?
// Can we cut them down before writing them ?
@@ -4582,6 +4576,16 @@ void ASTReader::ReadDelegatingConstructors(
DelegatingCtorDecls.clear();
}
+void ASTReader::ReadExtVectorDecls(SmallVectorImpl<TypedefNameDecl *> &Decls) {
+ for (unsigned I = 0, N = ExtVectorDecls.size(); I != N; ++I) {
+ TypedefNameDecl *D
+ = dyn_cast_or_null<TypedefNameDecl>(GetDecl(ExtVectorDecls[I]));
+ if (D)
+ Decls.push_back(D);
+ }
+ ExtVectorDecls.clear();
+}
+
void ASTReader::LoadSelector(Selector Sel) {
// It would be complicated to avoid reading the methods anyway. So don't.
ReadMethodPool(Sel);
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index 44cf99fe0b..3cc2dae4fc 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -2852,8 +2852,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls,
// Build a record containing all of the ext_vector declarations.
RecordData ExtVectorDecls;
- for (unsigned I = 0, N = SemaRef.ExtVectorDecls.size(); I != N; ++I)
- AddDeclRef(SemaRef.ExtVectorDecls[I], ExtVectorDecls);
+ AddLazyVectorDecls(*this, SemaRef.ExtVectorDecls, ExtVectorDecls);
// Build a record containing all of the VTable uses information.
RecordData VTableUses;
@@ -3121,10 +3120,7 @@ void ASTWriter::WriteASTChain(Sema &SemaRef, MemorizeStatCalls *StatCalls,
// Build a record containing all of the ext_vector declarations.
RecordData ExtVectorDecls;
- for (unsigned I = 0, N = SemaRef.ExtVectorDecls.size(); I != N; ++I) {
- if (SemaRef.ExtVectorDecls[I]->getPCHLevel() == 0)
- AddDeclRef(SemaRef.ExtVectorDecls[I], ExtVectorDecls);
- }
+ AddLazyVectorDecls(*this, SemaRef.ExtVectorDecls, ExtVectorDecls);
// Build a record containing all of the VTable uses information.
// We write everything here, because it's too hard to determine whether