Remove elements from Sema.UndefinedInternals as functions are defined. Also
filter the elements before emitting them into a PCH. No user-visible
functionality change, except that PCH files may be smaller?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174034 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index ac86d41..d38b530 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -1,4 +1,4 @@
-//===--- ASTReader.cpp - AST File Reader ------------------------*- C++ -*-===//
+//===--- ASTReader.cpp - AST File Reader ----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -5963,7 +5963,7 @@
}
void ASTReader::ReadUndefinedInternals(
- llvm::MapVector<NamedDecl*, SourceLocation> &Undefined) {
+ llvm::DenseMap<NamedDecl*, SourceLocation> &Undefined) {
for (unsigned Idx = 0, N = UndefinedInternals.size(); Idx != N;) {
NamedDecl *D = cast<NamedDecl>(GetDecl(UndefinedInternals[Idx++]));
SourceLocation Loc =
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index 25e3d52..8120799 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -3590,10 +3590,11 @@
// Build a record of all used, undefined objects with internal linkage.
RecordData UndefinedInternals;
- for (llvm::MapVector<NamedDecl*, SourceLocation>::iterator
- I = SemaRef.UndefinedInternals.begin(),
- IEnd = SemaRef.UndefinedInternals.end();
- I != IEnd; ++I) {
+
+ SmallVector<std::pair<NamedDecl *, SourceLocation>, 16> Undefined;
+ SemaRef.getUndefinedInternals(Undefined);
+ for (SmallVectorImpl<std::pair<NamedDecl *, SourceLocation> >::iterator
+ I = Undefined.begin(), E = Undefined.end(); I != E; ++I) {
AddDeclRef(I->first, UndefinedInternals);
AddSourceLocation(I->second, UndefinedInternals);
}