summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 1199803a9c0..366d4b39fc5 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -2738,12 +2738,15 @@ uint64_t ASTWriter::WriteDeclContextLexicalBlock(ASTContext &Context,
uint64_t Offset = Stream.GetCurrentBitNo();
RecordData Record;
Record.push_back(DECL_CONTEXT_LEXICAL);
- SmallVector<KindDeclIDPair, 64> Decls;
- for (const auto *D : DC->decls())
- Decls.push_back(std::make_pair(D->getKind(), GetDeclRef(D)));
+ SmallVector<uint32_t, 128> KindDeclPairs;
+ for (const auto *D : DC->decls()) {
+ KindDeclPairs.push_back(D->getKind());
+ KindDeclPairs.push_back(GetDeclRef(D));
+ }
++NumLexicalDeclContexts;
- Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev, Record, bytes(Decls));
+ Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev, Record,
+ bytes(KindDeclPairs));
return Offset;
}
@@ -4288,10 +4291,12 @@ void ASTWriter::WriteASTCore(Sema &SemaRef,
// Create a lexical update block containing all of the declarations in the
// translation unit that do not come from other AST files.
const TranslationUnitDecl *TU = Context.getTranslationUnitDecl();
- SmallVector<KindDeclIDPair, 64> NewGlobalDecls;
- for (const auto *I : TU->noload_decls()) {
- if (!I->isFromASTFile())
- NewGlobalDecls.push_back(std::make_pair(I->getKind(), GetDeclRef(I)));
+ SmallVector<uint32_t, 128> NewGlobalKindDeclPairs;
+ for (const auto *D : TU->noload_decls()) {
+ if (!D->isFromASTFile()) {
+ NewGlobalKindDeclPairs.push_back(D->getKind());
+ NewGlobalKindDeclPairs.push_back(GetDeclRef(D));
+ }
}
llvm::BitCodeAbbrev *Abv = new llvm::BitCodeAbbrev();
@@ -4301,7 +4306,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef,
Record.clear();
Record.push_back(TU_UPDATE_LEXICAL);
Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record,
- bytes(NewGlobalDecls));
+ bytes(NewGlobalKindDeclPairs));
// And a visible updates block for the translation unit.
Abv = new llvm::BitCodeAbbrev();
OpenPOWER on IntegriCloud